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.
2 simple Condition fields giving wrong answers on a Payment formAsked by LHEDJ on October 07, 2016 at 05:25 AM
I've published the payment form as a Template so ya'll can have a play with it.
Form Name: Error on Make a Payment (Photography) by LHEDJ
Template Link: https://www.jotform.com/form-templates/error-on-make-a-payment-photography-by-lhedj
Visit the Pre-Fill link below.
The field "Sub Total" adds the Total for 1st, 2nd, 3rd & 4th Child together.
The field "5% Discount Amount..." is simply ("Sub Total" x 0.05).
The field "Total Amount Due with 5% Discount" is simply ("Sub Total" - "5% Discount Amount...".
So why isn't "Total for 4th Child" apart of the calculations??
Weird thing is, after navigating to the pre-fill link I can delete one of the many "&", hit enter, after it loads click the back button and the form looks fine, but it's the same link??
Pre-Fill link to form:
The issue with your form is actually something else. The fields that should be filled are marked as "Read Only" so they are no longer fillable. The calculation issue you are addressing does not exist tough. You used the calculations perfectly well and when the fields are fillable it calculates the amount of discount successfully.
Once you change the read only statuses of the fields that should be filled your issue should be resolved.
Please check it and get back to us if the issue still persists.
I originally posted the working screenshot by accident, above is now the error shot.
The fields are Read Only because the info comes from an order form. I'm sure if the person paying could change the amount payable I'm sure they'll try.
I've since identified the problem field is "Total for 4th Child"
Total for 1st, 2nd & 3rd Child = 100
The Discount & Total Due are right for these fields but clearly not the for the 4th.
I have checked your JotForm and the URL being used. I notice that the 4th Child field name is incorrectly used as totalFor18 where the correct field name is totalFor23.
Could you also try using Calculation widgets to perform the calculation instead of using conditions on a text field to see if that helps?
Let us know how it goes. We will be happy to assist you further.
I tried replacing the "Total for 4th Child" field and didn't update the Pre-Fill link, sorry.
I tried using a Calculation widget but got the same error result.
I can see that the "Total Amount Due" field has taken an invisible amount of 30 (which is 5% of 600) and 3.5 (which is 5% of the 1st & 2nd child) from 100 (which is the total of the 1st, 2nd & 3rd Child)
Since it is a calculation field, the calculations cannot be completed as the form loaded. However, a focus out or key press would get the calculation done. I have cloned your JotForm to my account and replaced the text fields with calculation fields to avoid conditions. Also, I added a page break so that the calculation on the form shall be done.
Please see the link below:
You may clone the form again to your account to see how it works.
Please check and let us know if you need any further assistance. We will be happy to assist.
Thank you so much Kiran,
I tried something similar regarding your suggestion that calculations don't always work on loading the Pre-fill, by adding a Check Box that completes the calcs :-)
On behalf of my colleague, Kiran, you're most welcome. I believe it is safe to say that your issue is not fixed. Please feel free to contact us anytime, if you have any other questions or concerns.
issue is fixed :-)