Calculate number from multiple texts?

my text output is dynamic because it based on specific conditions and it will change everytime…

for example: if the user choose A & C >> result = 89
if V & D >> result = 100

I have added all of the conditions in text element (see image) + I send text element data as custom state

now I need to calculate the SUM of all 5 text elements ( I use math.js plugin or Toolbox), but it doesn’t work …

how can I calculate different text or input that are changing based of user choices on the previous steps??

You have to set the value of those inputs to custom states. That way you can have one input that is the SUM of all the custom states and each other input just displays the Number from its corresponding custom state. Also the input’s displayed value will change/update as your calculations update the custom states.

1 Like

I am not sure I understand you well…
Can you share screenshots?
and would it be different if I am using ‘text’ element and not ‘input’ element

and the value of text changes based on conditions (not user input)…

how can I send custom states based on conditions

Here is an example:

Here is the editor:

How about using input boxes rather than text boxes (just style them to look how you want and select ‘this input is disabled’). No need for custom states or math js etc. then.

Here’s a link to the editor where I mocked this up: Google-analytics-api | Bubble Editor

Front end (Your Bubble app) looks like this:

The ‘conditionally change’ button is just so you can test that it works with conditions.

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