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

    Calculating only the values of visible form fields

    Asked by nickma on October 26, 2016 at 08:53 AM

    Hi, 

     

    Firstly let me say what great support you have, I have been getting my head around using your forms and calculation and the support has always been really good and very good and making it clear how to use your forms and widgets.

    However I'm still stuck, still working on the calculation within this form: 
    https://form.jotformeu.com/62976611426360

    It's doing the calculation fine, but it's adding all the drop down fields together. How do I amend the calculation so it works out just the drop down field the form is currently being selected?

     

    Thanks, Nick

    calculations selected thanks jotformeu how to use
  • Profile Image
    JotForm Support

    Answered by Boris on October 26, 2016 at 11:34 AM

    Hi Nick, if I understand correctly how your form should calculate the value, then this should be an easy fix. We have two problems with the current set up.

    1. When a field is hidden (by selecting another option inside the Fencing Options field), its value is still being counted in the calculation. To make sure that a hidden field loses its value and doesn't get calculated, we should open up your forms Preferences:

    Once there, switch to the Advanced tab, click Show More, and change Clear Hidden Field Values to Clear On Being Hidden:

    2. The other problem with the calculation is that it will create a number with a larger number of zeroes, due to the way the calculation is set up. Essentially, your calculation is this:

    Close Board Close Board Larch Lap Larch Lap Burberry Panel, times Number of Fence Panels.

    If we select any value from the first Close Board field, say a value of 110, it will actually add a zero for each empty drop down field after it in the calculation, so your calculation would currently calculate as:

    110 0 0 0 0 * Number of Fence Panels, essentially giving you 10.000 times greater result then desired.

    To overcome this, I would recommend wrapping the first part of your calculation inside parenthesis, and add a plus sign in between each field, like so:

    Please do try it out and let us know how it goes. Cheers!