Setting a state (as number, not text) from a URL parameter

I’m getting an error message on the following, even though it’s working just fine. Is there a better way to do this, or might Bubble be surfacing an error that isn’t an error.

The details:

  1. I have a workflow that on page load, sets a state.
  2. The state is set using the function “Get Data from a Page URL”
  3. The value is a number (1, 2, 3, or 4) that was passed using the parameter Tab (and the state is set to numeric, not text).

The app works like this, but I’m getting an error in the editor saying:

Set state: Value should be a number but right now it is a text

Any advice? Is there a better way to set this up to pass numbers via URL?

Screenshot of my set-up:

I believe, it is assumed that parameters sent via URL are strings. (texts) Even though a string may only have numbers, it can still be interpreted as a string which is why a type for inputs can be ‘Text (numbers only)’ too.

1 Like

I believe… and I may be wrong… anything that gets put into the URL is a text even if it’s a numeric value. The URL can’t hold “type” information like that.

Can your selected-tab state just be a text value? It’ll still recognize numbers. Using a number type for a state just allows you to perform math operations, but I’m assuming since your state is called “selected-tab” you’re using it to toggle between views of groups. A text should be totally fine for this and you can grab that number from the URL.


Gaby | Coaching Bubble

Thanks for the feedback. I’ll go ahead and change the state to text.

A bit frustrating to have to re-work an entire page (37 elements, many with several conditions) because Bubble doesn’t support receiving numbers via a URL parameter. Oh well.

1 Like

It does take a number!

See this demo I have set up for you, on the index page there is a input box that will only accept a number…try setting a letter. Then click the button to send it via a page url parameter.

On the rcv page, the url is passed into the input field, which again only accepts numbers. Try enter a letter into to prove that!

If you then try and cheat by putting a alphanumeric entry e.g. 45ab78 into the url paramter manually, when it is loaded to the page, it will cut off after the 45.

Thanks for sharing.

I’ve already updated my page for text, but for my future reference (and for everyone else who comes across this thread in the future) are you able to get this working without an error message from within bubble?

Per my explanation to start the thread, I could get a number to work as well, but it continued to show up as an error in Bubble which makes me think it’s not as stable.

Are you seeing the same, or something different? If different, any idea how you’re making that work?

I never considered any error handling, however i have now added a workflow unhandled error and an alert message to the rcv page and not seeing any errors.

What errors do you get?

From my original explanation:

I put a group on the page with Type Number, set its source to the input box value, then added a Text box to the group with its source set as the groups thing.

Works fine as a text to number converter.

Ahh. Cool trick. Wish I had thought of that!

I was having trouble setting a state as a number via a URL parameter, and seems the same trick could be applied by using an input field that’s set to be a number to faciliate the interpretation of 1 as a number and not a text string.