Parse calculated values from form to db update api

I have created a serverconnect form with a number of selects.

I can update the db with separate values derived from the selects.

I would like to also apdate the db with the total numeric value of the selects.
I have created a heading which I will hide to calculate the total value.
I have tried creating a variable on the page but cant access that from the server side api

My questions are:

  1. Is this the best way of updating the db with the total values?
  2. I have given the heading a name, will this enable me to parse its value from the form to the insert data server side api?
  3. Can you suggest alternative methods?

Thank you :slight_smile:

Server connect can’t read any values on the page - you have to send values using URL parameters or forms (ie GET or POST variables). In this case, use a form field to calculate/store the total value and send that to the server.

Hi Tom

But isnt that what I have already done?

I’m not sure why you’re putting the value into a heading. It needs to be in an input - something like this:

<input id="text1" name="text1" type="text" class="form-control" dmx-bind:value="(select1.value.toNumber() + select2.value.toNumber() + select3.value.toNumber())">

1 Like

Your inputs are available in server connect as $_POST vars, so you can also do the calculations there.

1 Like

Great works a treat...thankyou

1 Like