What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Unable to include the field into calculations formula when underscore (_) is in its name

    Asked by bdoodle on June 23, 2015 at 02:37 PM

    I'm trying to add the value in "gear only shipping charges" field to "new order total" field.  The calculation for new order total currently takes the order total (flyingScot95) and subtracts the "Adjustment" field value.  I want it to also add the value in gear only shipping charges.  The wizard lets me add the + and gear only shipping charges field, but if I go back into the wizard to look at it, the new field is missing from the formula. 

    In addition, I show the "new order total" field if either the "Adjustment" field value or the "gear only shipping charges" field value is > 0.  (See conditions.)  However, when Adjustment field is 0 and gear only shipping charges field is > 0, the value in the new order total field is 0.  It should at least show the order total (flyingScot95) even if it's failing to include the gear only shipping charges due to the problem described in previous paragraph.

    NOTE: A value will be put into the gear only shipping charges field when the order is < $415 and over 0.  i.e. when the customer only orders accessories or extras, not a sail. (See conditions.)

    Page URL:
    http://www.madsails.com/Order_FS_sails.html

    Screenshot
    addition conditions math form calculation
  • Profile Image

    Answered by Ben on June 23, 2015 at 03:59 PM

    I see that you have set the New Order Total to be added to itself + the Gear Only Shipping Charges.

    I would always advise against such setup since it could lead to incorrect values.

    This is due to the fact that code runs in circle. So each incremental time it comes to that plus it would add up the previous value already in the New Order Total and increase it by itself and the Gear Only Shipping Charges.

    For example if the New Order Total is 1 and Gear Only Shipping Charges is 2, it means that it should show 3. If we take the fact that the code runs in the above mentioned manner, it would mean that it does the following instead:

    1 + 2 = 3 ==> 3 + 2 = 5 ==> 5 + 2 = 7 ....

    Another thing to suggest is to always use Form Calculation to calculate the value. If you must use conditions, never use them to insert the value into the Form Calculation. Instead create a hidden field that would be used by conditions to insert some value and Form Calculation to use that value.

    Doing so you break the math that you had set in side of it and could cause conflicts with different code trying to do different things.

    What I did was to remove the condition in question

    and then change the setup in the Form Calculation to do the same thing:

    Now when I did this part, I did notice that same thing that you have experience where the field is just removed from the widget, but I was able to resolve this by changing the field name from: gear_onlyShipping291 to gear-onlyShipping291.

    Notice that the only difference is the change from underscore to dash.

    This seems to have resolved it, but I will still raise this to our developers to take a look into to make sure that everything is functioning properly.

    If you wish, feel free to try and embed my clone of your form on your website to see if it works before making any changes. This is the link to it: http://form.jotformpro.com/form/51736163502955

    To me it seems to be working properly and to resolve the issue.

    As soon as our developers resolve this issue you will be updated about it through this thread.

  • Profile Image

    Answered by bdoodle on July 11, 2015 at 07:03 AM
    Thank you!
    ...
  • Profile Image
    JotForm Support

    Answered by Chriistian on July 11, 2015 at 08:12 AM

    Hi bdoodle,

    On behalf of my colleagues, you are welcome. If you have any further questions, please feel free to contact us again.

     

    Regards.