Math form functions

How do you use app connect to add 3 form fields together and display the sum in a 4th form field? This would continue with other math functions from there, multiply, subtract, etc. with other form fields. Tried several ways using operation but can’t seem to grasp it. Any help would be appreciated.

This can all be done using the Wappler UI.

For the 4th field, go and set a Dynamic Attribute from the properties section.

From there you can set its value to equal the sum of any other input fields by choosing them in the data picker

Or you can write it in the code view like this:

<button class="btn btn-action-round" dmx-bind:value="(inpupt1.value + input2.value)">                                                                      
</button>

I just used button as it was open on a test page

Just to add to the reply above you may also need to add this formatter to convert from a string to int

thank you Phillip, but sorry_duh gve me what I was lacking. Had the process down, but didn’t add the number conversion - thank you very much.
On another note do you also know how to generate a random number for a form field

This might help.

Thank you for the solution. It does indeed work I can see it in the source code, but I can’t get it to display in a form field. Having a major brain fart on this - help please. Here is my code - tried wrapping it around the form field:

{{myNumber.value()}}
                                        </div>

Here is my form field where I did the same thing. Maybe it will help you.

<input type="hidden" class="form-control form-control-sm" id="hiddenId" name="hiddenId" aria-describedby="input3_help" readonly="true" dmx-bind:value="randomId.value">

Thanks Brad that did it - don’t know why I keep forgetting to use the dmx-bind:value vs just value. Thank you again!

1 Like

My bad - I got it - thank you. AGAIN dmx:value!