Reseting a calculation field to zero when changing the selection in the dropdown.

  • klausdyba
    Asked on February 6, 2017 at 3:25 AM

     

    In a drop down you can choose to rent a studio full day (ganzer Tag) or half day (halber Tag). Doing so, a hidden drop down with different timeslots shows up (in one you can choose timeslots of 8h and the other of 4h) for each. 

     

    I want to calculate the endtime of the appointment. But the important thing is, that it needs to send booth values seperatly to one field cause I need it for zapier (zapier reads just one endtime field).

     

    So if you change the timeslot dropdown, it should zero the calculation field (fieldname:final endzeit calculator), so the math for the other is right. Right now it just adds the 2nd field value to the other.

     

     

    https://form.jotformeu.com/70252202681345

     

     

  • Özlem JotForm Developer
    Replied on February 6, 2017 at 3:51 AM

    Hi,

    According to my understanding, you are wondering how to set values to default value when the user changes dropdown selection.

    ''So if you change the timeslot dropdown, it should zero the calculation field so the math for the other is right. Right now it just adds the 2nd field value to the other.''

    Please have a look at the following guide:

    Open Settings>Form Settings>Show More

    Reseting a calculation field to zero when changing the selection in the dropdown Screenshot 30

    Set the "Clear Hidden Field Values" to "Clear On Being Hidden"

    Reseting a calculation field to zero when changing the selection in the dropdown Screenshot 41

    When you make this change on your form, values in conditionally hidden fields are set to zero. 

    If you need any other supports, please feel free to let us know. 

    Thank you.

     

  • klausdyba
    Replied on February 6, 2017 at 4:15 AM

    Ah thank you! I saw that info, but didnt know where it is in jotform 4.

     

    However, there is still a mistake. 

     

    From the start, the form prechoose ganzer tag (full day) and shows the timeslots with 8h length. 

     

    I made a calculation for endtime with ganzer tag (full day) + 8

    This works and shows 16 (endtime 8+8)

     

    when i choose half day and the hidden dropdown "half day/halber tag" shows up, it says a wrong endtime in the calculation field... still 16 instead of 12. (8pm + 4h)

     

    any idea?

     

    regards,

     

    Klaus

     

  • Charlie
    Replied on February 6, 2017 at 5:19 AM

    Hi Klaus,

    Your field titled "final endzeit calculator hidden" has these conditions:

    Reseting a calculation field to zero when changing the selection in the dropdown Screenshot 50

     

    Noticed that conditions #2 and #3 above states that if "ZEITRAUM halber Tag" is FILLED and the other is if "ZEITRAUM 1 Tag" is FILLED. Noticed that this is somehow will result to inaccurate results because ZEITRAUM halber Tag and ZEITRAUM 1 Tag has default items selected:

    Reseting a calculation field to zero when changing the selection in the dropdown Screenshot 61

    In V4 form builder, here's how you can find it:

    Reseting a calculation field to zero when changing the selection in the dropdown Screenshot 72

     

    These default selections are triggering the conditions which uses the "IF FILLED" statements. Both full day and half day are both filled by default so changing the options will not work.

    You either need to change the default selection to empty OR change your conditions, instead of use "ZEITRAUM 1 Tag" and "ZEITRAUM halber Tag" to trigger calculation on "final endzeit calculator hidden", use "Art de Buchung" instead.

    Here's an example:

    Reseting a calculation field to zero when changing the selection in the dropdown Screenshot 83

    You can see that if ANY of the "1/2 Tag (4h)" options in Art der Buchung is selected, then the calculation will be triggered. 

    See which one would be best fitting, I am not sure if I understood the whole process though.

    Let us know if I missed something. 

  • klausdyba
    Replied on February 6, 2017 at 5:32 AM

    Thank you! the 2nd answer helped my problem. All is good now!

    I prefered it cause I wanted to show a time instead an empty drop down. 

    What a great support!!

     

    Klaus

  • Charlie
    Replied on February 6, 2017 at 5:38 AM

    You are most welcome. I'm glad that it helped. Should you need our assistance again, feel free to drop by here in the forum.

    Thank you :)