Need help with a simple test

I’m new to bubble and i am trying to set up a simple model to test the logic controls.

I have a page with a button and a text element. I want to click the button and have the text element display a number that increases by 20 every time it’s clicked.

My A.I. bot says it’s possible but I can’t get the display to work.

Can someone show me how that is done?

Thanks in advance. -DJ

Hi there, @djtechwise… one way to do what you described is to create a custom state (maybe at the page level) with a state type of number, and set the text element to show the custom state’s value (note that to select a custom state in an expression, you must first select the page/element with which the state is associated). Then, add the Set state workflow action to the button, and set the custom state to its existing value (select the custom state as the first part of the expression) + 20.

Hope this helps.


Thanks. I have done that and the debugger steps show the the value of the text element increases but when the debugger reaches the end, the text element always shows 0 on the page. How do you get the text element to display the new total? This seems dumb, what am I missing?

If the text element is displaying the custom state’s value, then the element will always show the new total. Share some screenshots of your setup.

Yep, I think I just need to get for familiar with this. I’ll keep working with it. I did get the text element to display the total by setting it to display the state’s value as you said. Thanks for the help!

I have used FileMaker for building most of my custom applications. Trying to make the migration to bubble. It would be helpful for me if you could answer a couple questions-

Can input elements work in the same way as this example?

Are custom states like global variables?

Any comments would be appreciated. -DJ

If you are asking if you can display the custom state’s value in an input element, the answer is yes, and you would do that by setting the input element’s Initial content field to the custom state.

For more info about custom states, you can start by checking out Bubble’s documentation.

This topic was automatically closed after 70 days. New replies are no longer allowed.