Calculations inside of my form are not working correctly

  • azstruhar
    Asked on July 1, 2015 at 8:25 PM

    Working on '3 Student Registration Template.' It is showing fields it shouldn't be showing. It is failing to perform basic calculations no matter how I configure it. It acts as if maybe check boxes are pre-checked before the form loads, although I know that isn't the case.

    Little help?
    Thanks

    Calculations inside of my form are not working correctly Image 1 Screenshot 20

    Here, 2 Elective Weekday, Time, Instructor Preference appears on form load. It should not appear until called for by a rule.

    The form start exhibiting strange behavior, including the inability to perform simple calculations. I'm stumped.

    For example, if here I check and uncheck "Student 2" the line that should be hidden goes away.

  • BJoanna
    Replied on July 2, 2015 at 4:41 AM

    I have inspected your form and it seems that "Registration Fee" field is causing wrong calculation. I would suggest you to add new field "Registration Fee" and hide old field and add conditions to your new field. 

    Calculations inside of my form are not working correctly Image 1 Screenshot 40

    I have also removed $ sign inside of calculation fields inside of my cloned form.

    Calculations inside of my form are not working correctly Image 2 Screenshot 51

    Also when I inspected your form "2 Elective Weekday, Time, Instructor Preference" was not shown, it was hidden by condition.

    Here is my cloned form where I added new Registration Fee field. 

    http://form.jotformpro.com/form/51821756320956? 

    Calculations inside of my form are not working correctly Image 3 Screenshot 62

    Feel free to clone my form if you want to take closer look to my conditions. 

    Hope this will help. Let us know if you need further assistance. 

  • azstruhar
    Replied on July 2, 2015 at 9:38 AM

    I had to completely change the way these elements were hidden/shown because it was not working properly. Originally, I had a condition to show them if an elective were selected. It was working fine this way but suddenly stopped working. I then had to explicitly hide them until an elective was selected. This seems to be working for now.

    The registration fee field needs to be $15 if only one student is registering, $30 otherwise. I've tried several different approaches to this, they all seem kluldgy.

    Thanks for your help.

  • azstruhar
    Replied on July 2, 2015 at 10:20 AM

    I've made a number of changes. I still can't see why my new 'subtotal'  'sales tax' 'grand total' fields don't calculate properly. I think if I understood the logic behind how/when/why these fields update I could find a workaround.

  • Boris
    Replied on July 2, 2015 at 11:28 AM

    If I understand correctly what you are trying to calculate in the Subtotal field, then please tick the option in the Calculation to Ignore Hidden fields.

    Otherwise, fields such as the Family Discount are being included in the calculation, even though the fields are hidden.

    Calculations inside of my form are not working correctly Image 1 Screenshot 30

    This is how the calculation looks for me after that single change:

    Calculations inside of my form are not working correctly Image 2 Screenshot 41

    I hope this helps. Please let us know if you need further assistance.

  • azstruhar
    Replied on July 2, 2015 at 11:41 AM

    I made this suggested change. When I make the same '1 Course Selection' (I assume you chose 'Petite Dance' as tuition was $42) I get 57 in Subtotal, 1.05 in Sales Tax, 16.05 Grand Total. These totals are incorrect.

    Also, Student 2 Total and Student 3 total shouldn't appear unless the 'Add Student 2' or 'Add Student 3' are selected.

    The form is behaving differently for you than for me. I have cleared the form cache more than once, and the browser cache, and tried a different browser.

  • azstruhar
    Replied on July 2, 2015 at 11:45 AM

    Calculations inside of my form are not working correctly Image 1 Screenshot 20

     

  • Boris
    Replied on July 2, 2015 at 12:29 PM

    Yes, I have clicked on the Student 2 and Student 3 just to show if they are being calculated, that is why they were shown in the image. I have used the Petite Dance, that is correct.

    When it comes to the calculation of the tax and grand total, I can see that the calculation doesn't always update as you change your options. The 1.05 in the tax field is exactly 7% of the registration fee (15), which suggests that your Sales tax is being calculated before the Subtotal field.

    This is happening because you have both a Condition and a Calculation "fighting" each other on which one is going to update your Subtotal field. Please try disabling the condition for the Subtotal field, and see if this helps.

    Calculations inside of my form are not working correctly Image 1 Screenshot 20

  • azstruhar
    Replied on July 2, 2015 at 12:55 PM

    Removed the condition. Still only getting 7% of 15.

  • Boris
    Replied on July 2, 2015 at 1:34 PM

    I have tested your form, and no matter which option I choose for the Course Selection, all the fields are calculating properly on my end.

    The only time that it doesn't is when there was something selected in the Course Selection, and then cleared - the calculations remain from the Registration Fee that is conditionally removed. This is a cosmetic issue, as your users can't submit the form anyway with the required Course Selection being empty, but to remedy this you can add a Condition to set Registration Fee to zero when none of the Course Selection fields are filled.

    Calculations inside of my form are not working correctly Image 1 Screenshot 20

    If you are still getting incorrect calculations, please do let us know the exact steps it takes to encounter the issue. Such as are you opening the form in a new tab, or refreshing the page? What fields do you select / deselect to have the calculation misbehaving?

    Thank you.

  • azstruhar
    Replied on July 2, 2015 at 2:02 PM

    Open form. Select 1 Course: Predance. Check 'Tumble Tots.'

    Form calculates correctly so far.

    Now Select 2 Course: Predance.

    Tuiton Total = 79 which is correct,

    Family Discount shows -8.9 which is incorrect.

  • azstruhar
    Replied on July 13, 2015 at 6:27 PM

    The solution here was to not allow fields to rely on other fields for input. I had to create conditional calculations for each field independently. 

    Also, as I was trying to make the form failsafe, I evidently overwhelmed the form's ability to manage conditions and calculations, as all kinds of errant data was appearing in random fields. The solution was to streamline the conditions to cut down on the sheer number of them.

    So far, the revised version of this draft form is working very well at 

    http://form.jotform.us/form/51837130874155

     

  • Chriistian Jotform Support
    Replied on July 13, 2015 at 9:44 PM

    Hi azstruhar,

    Thanks for sharing to us the solution/workaround you have created to fix the issue. If you encounter any problems again, do let us know so we can further assist you.

     

    Regards.