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.
Calculation conditions not workingAsked by SunbridgeInstitute on January 14, 2016 at 11:30 AM
I've been struggling with this for a couple hours now. I'm certain that my calculation conditions are set up correctly, and yet they are behaving very strangely.
I will give you one example of what is happening here below, but this is one of many:
Please see the screen shot attached.
With these selections, the form fields should be as follows:
-waldorf weekend discount $110
-Final tuition 890
But instead it's giving me 1000 for the waldorf weekend discount, and it's also adding in 1000 to the alumni/community discount, and the total tuition turns out to be zero.
When I did a refresh on the page, just to see if that did anything, then it zeroed out the alumni community discount, but kept the 1000 in the waldorf weekend discount, and total tuition is still zero.
Thank you for your help!
conditions form calculations conditions math insert value
UPDATE: I found an error in my calculations which is solving some of this problem, but I still can't figure out why the Tuition Subtotal keeps getting inserted in the Alumni/Community Discount. The logic for this field only has a calculated value inserted if there is a correct coupon code. Thank you if you can help with this!
Ugh--I spoke too soon. It's still acting wierd. Now the tuition subtotal is getting copied into the various discount fields instead of actually calculating the discount that it should be. I'm sorry to be so confusing.
No need to apologize, we know best how things can get out of hand and everything to seem set up correctly until a small catch is found.
Now, before we proceed I do wish to mention that the auto-fill option could impacting the results - and is highly likely to do that as well.
To rectify this, it is best to first change its setup to lowest TTL - time for which it is live for.
After setting it up like so and saving the form you would need to refresh the form (or open it if you had it closed). Then go back to the edits and turn off the auto-fill feature while creating your form.
Now once you save you should go to your form and do a cold refresh - CTRL + F5.
This should cause it to reload everything and not use the saved data. If it still shows you any details that you had previously entered, the best option would be to try the private window (In Firefox this is File -> New Private Window), where you can open the form.
Now checking form would give you the proper results.
Next to this above, I notice that you are using conditions on form calculation - to update its value, while in the same time you are setting it up to grab the value from the field.
It is never good to insert values to form calculation through conditions or you will experience issues, but if you also set it to get its own value, that means that it will certainly make it do unexpected things.
The best way to set this up would be to either use form calculation to capture the value of some field or to use textbox field and pass conditions on the same - instead of passing it to form calculation.
For example, you could set up form calculation to grab the field and take (deduct) the value form another field. Then set up conditions to update that field with the discount amount or set it to 0, making it apply a discount (1000 - 110 = 890) or leave it without any discount (1000 - 0 = 1000).
Ben, you are the BEST! I have to tell you I am in a desperate situation because my form is due tomorrow morning and the most important aspect of the form has not worked even once yet, and the level of error is very complex, giving different totals at the beginning and end of the same form, and even different amounts on the emails that go out. My level of confidence in Jotform has gone from an all time high last week to an all-time low right now.
Having said all that, I have already made the change you suggested earlier (for which I am so incredibly grateful). All these other suggestions are awesome and I will try every one of them this evening if possible. I hope, hope, hope that something magical will happen and allow me to get these calculations working reliably.
Thank you again for giving me an extensive list of things to try so that I have some hope of meeting my deadline.
Okay, Here's what I did:
-turned off the auto-fill option
-preview and enter new information. Still wrong calculations. It still puts the totals in the discount fields.
So now you are talking about setting up my calculations differently, and I can appreciate the gist of what you are saying but I don't understand what I should do differently.
I don't know what you mean when you say "using conditons on form calculation while at the same time setting it up to grab the value from it's field." That definitely sounds like the source of my problem, but based on this description, I don't know, practically, what to look for in my form as the issue, and I don't know what to do in order to correct it.
I read through the rest of your email a few times and I just can't wrap my head around what you are saying, although I'm sure this must be what my issue is.
Can you give me some more details or better yet, can you give me a specific example so I can see exactly what you are doing to fix it?
Thank you so much for your help. I really hope that this will be reliable after this gets worked out! I'm so afraid that I'm not going to meet my deadline!!!
Thank you for another great feedback :)
OK, I understand and I apologize for this.
So what I did was to clone your form so that I can make changes on it without affecting your form. Then I made a screencap of what I meant.
You will see that all I did was to delete the form calculation widget of retrieving the value of the checkbox field.
As per my comments above, this will work, but is likely to cause further issues later on, so to make it work for tomorrow, you can apply the same change as I did and say that you would like to make further optimization for future use.
Then replace the form calculation widget with a plain textbox field that gets updated with the conditions instead.
Or a faster option (and do feel free to let me know if I need to add more details :) ) to simply change the value of form calculation to deduct the value using another field that gets updated by conditions instead.
OK, to avoid any confusion, this is the screencap of the first thing - form calculation and removing its value grabbing setup and seeing how it automatically starts working in the preview:
Want to check it out for yourself? Easy, just check this form: https://form.jotform.com/60135754721957
Want the form without doing the same steps - easy with the clone option: How to Clone an Existing Form from a URL
The steps to replace the same with textbox would be as follows:
1. add textbox to your form
2. set conditions that are updating the form calculation - Discounts received for Waldorf Weekend field through conditions to update the textbox we added in first step
3. the values need to be changed so that they are prepared for deducting from the subtotal.
4. edit form calculation (Discounts received for Waldorf Weekend field) to deduct a value of subtotal with the value of textbox we created above.
That is it :)
THANK YOU THANK YOU THANK YOU! I'm going to use this to see if I can understand what the building strategy is that I've been doing wrong, and also to launch this form in the morning. Thank you again; you are the best!
On behalf of my colleague Ben, you're welcome. He is one of the best support indeed! :)
Feel free to let us know should you need any further help.
I hope it's okay to continue this thread, since I am still under pressure to get this form done today. I have another issue on this same topic, which I was hoping would be resolved with Ben's fixes, but it was not.
Here's what I did: I just cloned Ben's version of the form, and here it is: http://www.jotform.com//?formID=60143546937964
The calculations work well now, as he expected. However, when the totals transfer over to the emails, they are coming in all wrong. Here's some copy from the emails that I got after submitting the form, the total which was $955 [1065 tuition subtotal minus a 110 waldorf weekend discount]:
Summary of your selection(s) Collaborative Leadership:,Waldorf Weekend: Tuition Subtotal 1065 Discounts received for 2-day 1065 Discounts received for Eurythmy 1065 Alumni/Community Discount 1065 Total Tuition $-1065 Choose your payment method My school requires an invoice to process payment TotalTuition Calculation $-1065
What is interesting here is that the only number that comes in to the email correctly is the tuition Subtotal. Both the discounts showing should be zero, and apparently the Waldorf Weekend Discount is empty since it's not showing, yet this is the one that should appear as 110. Of course the total tuition should be 955 instead of -1065.
Can you help me with this? Thank you so much for your prompt responses so far! I am still hoping I can meet my deadline today!!
Thank you again for a nice feedback :)
In regards to the emails, yes, this is what I meant in my first reply:
It is never good to insert values to form calculation through conditions or you will experience issues, but if you also set it to get its own value, that means that it will certainly make it do unexpected things.
The second part (after first comma to the end) is what we have resolved by simply removing the setup of Form Calculation to grab the value of the field next to having conditions fill out the value.
Now the first part is the one that was directed to the issues that you are experiencing at this time (they are often shown differently on each form).
I like to understand how it works to know what is causing it, so lets go through the steps and known facts (hope you will not mind):
1. form calculation is a widget that can help us with math on our form
2. form calculation is used to grab the value of some other field or widget into itself for further processing
3. form calculation has its own default value shown while it is not able or should not make calculation.
4. form calculation will do its best to keep its value properly updated
5. Conditions will do its best to update the field values as much as possible
OK, so this 3rd one is the one causing the issue for us at this time together with number 4 and 5.
Conditions are forcing their value, while form calculation is forcing its own (default value in this case) and as you click submit and the final check is made, the values get re-written and email contains different values than the ones that were shown - values set by the last system standing (either conditions or form calculation).
The solution here is to:
1. leave the sub total as it is.
2. Now have another field for discount - a plain textbox field - not a form calculation widget.
3. OK, once this is done, it is needed to set all conditions that were updating form calculation to do the same to the textbox we have made above
- Maybe best way to do this would be to make a clone of your form and do this on the clone - so that you always have a backup form to get back to either for reference or otherwise. This is done easily by following steps here: How to clone an existing form from your account?
4. As you make the change for this field, you need to apply the same steps for other fields on your form - where you have used conditions to update form calculations.
Once this is done no further issues should be present for neither the email nor the form itself.
Do of course let us know if you have any issues doing the same and we would be happy to assist as much as possible.
Thank you again for your thorough response. I do believe I am beginning to grasp the overarching error that I made in creating this form. I've begun to realize that I never want to have a yellow wand icon AND the green arrows icon on the same field. I have begun to go through and eliminate all cases of this, and if I understand your current email correctly, this will solve ALL the funny issues I'm having with my numbers.
Thank you again for your patience with me. I was obviously getting pretty confused with all the options for doing calculations and I didn't realize I was using both on the same field in many cases. It's good to know this so I can correct it. Thanks so much for your patient writing to help me understand in very basic terms.
It is OK to have the wand icon and conditions icon on the same field - it just means that there are some conditions set on a widget. - It could be show hide or some other condition, but I had noticed that many times the issue with calculations is caused by the form calculation and conditions used together (when conditions update it) - and this is the only one to be avoided.
So, if you have both icons, that is OK as long as it is not on form calculation and that the conditions are for updating the same.
If conditions are set to use the value from it, show or hide it, etc that is all good :)
If it helps we all had one time or another when we realized that we would need to redo some part of form until we got familiar properly with it. On the bright side, the next form will go so smoothly for you that you will just log in and log out with the form all set up :)
You are very kind; I am looking forward to that. Thank you again!
I am getting VERY CLOSE, and now I've run into a funny thing that I was hoping you could report to your developers OR explain to me...
I have replaced all of the Calculation Widget fields with text boxes as you recommended, and re-did all the calculation logic on those text boxes. Everything is working beautifully except one thing...
At the bottom I added a calculation widget calling for the Tuition Total. It keeps giving me the wrong number, even though I have no conditions on this field.
I tried making a text field with conditions on it instead, and this one works fine.
It seems like two different approaches to the same thing. One works, and the other doesn't. I will leave this in my form so that you can see it in action.
Here is my form below, and the fields in question are near the bottom. It only seems to cause this difficulty when I select a LOT of courses (like 9 or so).
Please let me know when you've had a look so I can remove the non-working one.
The biggest thing I have learned from this experience is: STAY AWAY FROM THE CALCULATION WIDGET if possible!
Thank you so much for all your help!!
I checked your jotform http://www.jotformpro.com/form/60143546937964 and I see the Final Tuition Calculation widget was just copying the value of Total Tuition widget
So basically the wrong calculation number is not coming form the Calculation widget but from the Total Tuition field.
as you can see on the video I have above, I could not capture the combination calculation yet that produces the wrong number in Final Tuition... but I assume you did.
Can you share to us the combinatiion/step to produce the wrong number (Total Tuition vs. Final Tuition) . We will be able to check what could be causing the wrong number once we know this.
That's what is so bizarre about this problem--it is just copying a value, so how can the copied value be different than the originating value? Something is wrong!
The way I found the problem was by choosing a LOT of courses at the top. I chose 9 different courses. Every time I chose a lot of courses, every combination recreated the issue.
I'm going to need to take that incorrect field off on Tuesday morning, so if we can resolve this by then, it would be great.
I think that the issue is related to the following condition with 'IS NOT EQUAL TO' rules. It is being applied automatically since the coupon field is not equal to such values.
Also, you have an 'ALL' option used within that condition, so it will not work properly. The 'ALL' option means that both rules should be true which is not possible in your case.
You may consider removing mentioned condition, and then setting up other one(s) for alternative coupons. Thank you.
Thank you for your help. I changed the one problematic condition that you pointed out. I made it say: If Coupon Code is empty, then insert formula
However, I am still having the exact same issue that I originally described. Maybe there is something else about my formulas that are not designed well?
Thank you so much.
Actually, I just changed that formula to say: If they have made any course selections then insert formula into Total Tuition. It may help to view the conditions that I have on Total Tuition, as well as those on Coupon Code for a complete picture. I want one of the formulas to be the default, and only if there's a correct coupon code, then the coupon code formula overrides the default formula.
Now, my form will still calculate the Alum15 formula but blanks out the Total Tuition. And for the Community coupon, nothing shows up for the coupon calculation, and the Total Tuition stays the same as before. So it's still not working.
Thank you again for your help!
I believe that we are still looking at the http://form.jotform.com/form/60143546937964 form.
* Advice: If you wish to leave something for us to take a look at, while still keep working on your form, my advice would be to simply clone the form - you can change the title so that it is something you can quickly know to be a bad form.
That way you can still work on your form and have us report the issue to our developers or see what might be wrong. In that case it is good to mention both forms to us :)
Now based on what I have understood, I have made selections as before:
1. Under Please indicate your choice of course(s)/workshop(s) field I selected:
Approaching Grade 2: July 3-8
Waldorf Weekend: July 22-24
This has caused the field Tuition Subtotal to show $1000
Discounts received for Waldorf Weekend shows $110
Total Tuition shows $890
The same value is passed to Summer Series Total Tuition, Final Tuition (text) and Final Tuition fields.
So far so good.
2. I insert "Alum15" (without quotes) into Coupon Code field.
This causes Alumni/Community Discount field to show $150, but Total Tuition immediately gets blanked out.
This of course causes a chain reaction so we now have Summer Series Total Tuition and Final Tuition fields showing 0 and Final Tuition (text) being blank as well.
For me this means that a bad value is being passed - such as an array, null or false - and that will always break conditions.
Good side of it is that it seems to be originating when Almu15 is added to the playground, so lets check that out :)
Looking at it, this time the issue is "false"
While your conditions were good, there is one issue with them, you added $ in front of the value. While that makes it look nicer, it also makes it wrong when further down the road it is used to make a calculation.
As such as soon as I had removed the $ in 2 conditions it started to work nicely :)
To compensate for the removal of the $ sign, you could optionally have a hidden field that you update with the use of conditions to show only a number and then have the same fields value inserted into another field that is shown (and not used in any calculations) with the $ sign.
You can see all of the above mentioned done on this form: https://form.jotform.com/60174607036956
- I only did it for Alum15 coupon code, so any new or existing ones would need to be recreated in the same manner - to have the dollar sign removed.
Do let us know how it goes :)
My goodness, I do appreciate your help, and I'm glad I got an extension til Wednesday on this form launch.
I did what you suggested and I removed all the $ from all my calculations in that area, just in case they were interfering. Now I do get the Alum/Community discount to calculate correctly, which is a step in the right direction.
The issue I have now, is that the Total Tuition is not reflecting the Alum/Community Discount when a coupon code is typed in correctly. I want this particular discount to override all of the 3 Combination Discounts that are the default calculations for Total Tuition.
Right now my Combination discounts are sticking in that Total Tuition field, no matter what I do, and I can't figure out how to make the override work.
Can you get me through this hump? I hope this is the last thing to overcome!! What a rollercoaster ride! Thanks again!
Please allow us some more time to check and figure out the correct calculation. We will get back to you shortly with update.
Any luck on this? My deadline for finishing this form is today, since launch is tomorrow morning. It seems this is the last problem I have to solve. Thank you so much for your help.
I checked your form and I think the reason why it is not working is due to the conditions with $( that are rendered as text instead of formula. This is what I see on the old condition wizard.
I simply recreated it and it seem to have fixed the problem.
Here's a cloned version of my colleague, Ben's form with this update https://form.jotform.com/60184674987976. Kindly check and let us know if this is working correctly. Thanks!
I actually found a similar issue while you were doing it too, and I found that things function a little bit butter when I take all the unnecessary parentheses out. So I have done that in the meantime.
Now the form does work better; HOWEVER it does not work entirely. When I add in the ALUM15 code, for example, when I am typing the "5" at the end of that code, I see the calculation of Total Tuition is correct. But as soon as I exit the Coupon Code field, then it reverts to the default calculation of Tuition Subtotal minus all the Combination Discounts. Same thing happens when I type the COMMUNITY code...after I tab out of the Coupon Code field, the Total Tuition calculation is wrong.
Here are the courses I picked so you can recreate:
Approaching Grade 1: July 17-22,Waldorf Weekend: July 22-24
Thank you so much for your help. I really hope i can resolve this soon!!!
Any luck on this? I'm sorry to be a pest but I'm supposed to finish this form today and my work day is already over. Thank you so much.
Can you please test this form https://form.jotform.com/60184674987976.
Please point out if you are still able to produce the problem on the test form itself.
I test the form and this is what I am getting
I did noticed that adding the Coupon Code changes the Total upside instead of discount... can you please confirm if that is specifically the problem.
Yes, I'm still getting the same problem on the test form. What happens is that when I'm typing ALUM15 into the Coupon Code, at the moment that I type "5" then the Total Tuition changes to the correct figure, but then when I leave that Coupon Code field to go on to the next field, then the Total Tuition reverts to the incorrect calculation.
Overall, the Alum/Community Discount should override the default Combination Discounts in cases where they have a coupon code.
For example, when I select Approaching Grade 1 and Waldorf Weekend, I get a Tuition Subtotal of $1000. Then there's a $110 combination discount, making the Total Tuition $890. When I enter the ALUM15 code in the Coupon Code field, then the Total Tuition should become $850 instead ($150 Alum/Community Discount). It does change to $850 for a moment, but after tabbing out of the Coupon Code field, then it reverts to $890. The fields on the bottom (including the payment tool) follow suit with the Total Tuition field at the top. When Total Tuiton is $850, the payment tool says $850. When it reverts to $890, then the payment tool says $890. It's not the payment tool I'm worried about, it's the function of the calculations between Tuition Subtotal and Tuition Total.
I really, really need to solve this problem TONIGHT. I've already had an extension on my deadline because of all these calculation problems, and they are going to hate Jotform if I have to ask for another extension. My "neck" is on the line because I'm the one that suggested we switch out of Formstack for Jotform. Please help!!
To answer your question "I did noticed that adding the Coupon Code changes the Total upside instead of discount... can you please confirm if that is specifically the problem." I'm sorry but I don't understand what you mean. I hope that my explanation of the specific problem above helps clarify what the exact problem is.
I have read your correspondence with my colleagues and if I understand correctly, the issue comes when you add a coupon code, the initial result for the total tuition is correct. But when you click on a different field, the tuition tuition changes and it display an incorrect value. Allow me to investigate this further and I will get back to you once I have an update.
It looks like the value in the total tuition field is being overridden by the conditions which is why the the tuition field calculates the combination discount instead of the coupon code.
Since the combination discount is not part of the calculation when there is a coupon code entered, a workaround I can suggest is to add a condition so that when the coupon code field has an entry, the combination discount will become 0. That way, it will not be calculated even when the user clicks on another field.
Here's a sample of that condition
You can also do the same on the other combination discounts.
Here's a cloned form where I applied the condition. As you can see, when I click on another field, the total tuition still remains at 850.
Here's the link to the cloned form: https://form.jotform.com/60187960576971
Do inform us if you need further assistance,
YAY! IT WORKS! I don't really understand why, but I'm glad it does. Thank you so much for your help!! Now we can end this insanely long thread! Thank you again!!!
OH NO! I spoke too soon; it is not actually working!!
Here's what I did: I added in 3 new conditions as you recommended; one for each of the combination discounts.
Now, I select the following courses: A Fresh Look at High School English: July 10-13,Waldorf Weekend: July 22-24
If I type ALUM15 into the Coupon Code, everything works fine. The Combo discounts zero out, and the Total Tuition recalculates.
HOWEVER, if I type COMMUNITY into the Coupon Code, the Combo discounts still zero out, and the Alumni/Community Discount calculates, but the Total Tuition does not recalculate. It just picks up from the Tuition Subtotal.
Furthermore, if I delete the text in the Coupon Code, the combination discounts do not recalculate--they either blank out or remain zero. This could be a problem if a person types the wrong discount code then deletes it--then they get zero discount when really they should get a combo discount.
Can you please help me quick?? This form is supposed to launch when I get to work this morning!!!
Are you currently working on the next form with 60143546937964 id?
The COMMUNITY coupon and recalculations look good on my side.
I've launched the form based on this reply, and will continue to test it.I'm concerned about the fact that I'm getting any strange results at all. Why would it sometimes misbehave? What could cause that? I do not feel like I "trust" this form.
Also, I'm still having trouble with the situation when a person types the wrong coupon code and then deletes it. Is there anything I can do so that the original Combination Discounts will be restored?
Thank you again.
It's not working, and my form is now live.Just now, when I type COMMUNITY into the Coupon Code, and tab out of that field, The Alumni/Community Discount calculates correctly, but the Tuition Total does not work. It just grabs the Tuition Subtotal.
When I got your message earlier, and tested it, it worked. But now it doesn't. I really need this to work reliably.
Here's a screen shot:
Please help! Thank you!
Here's ANOTHER aspect of calculations that are not working...the Final Tuition at the bottom of the form is not reflecting the correct Total Tuition value, even though it's calling for it directly. Here are some screen shots:
I have temporarily hidden the Final Tuition field because my form is live and I don't want to confuse the users, but I will need to UN-hide it as soon as possible.
Please note that my current issues are 2 messages deep in this threat (I have two active issues on this topic--one in this message, and one in the previous message)
How can I correct these issues? Thank you!
Hi, I am happy to hear that you were able to launch your form :) although not happy to hear that you are having issues with the same :/
Now looking at everything this thread is now quite long so it is hard to follow up on it (I always like to read from start to finish to see if there is something that might help), but also the issues are different and we should keep one issue / question to one thread.
As such I have now split up your posts above into multiple threads so that we can properly assist you with each.
http://www.jotform.com/answers/751016 - About the coupon code being removed, but the calculations not being properly updated.
http://www.jotform.com/answers/751022 - about the wrong value being updated once coupon field is left
http://www.jotform.com/answers/751025 - about final tuition and total tuition fields.
We will be updating each shortly and I would like to ask you to continue through each until we resolve an issue by issue :)