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.
Calculations based on drop down values with "allow multiple"Asked by DanBlum on June 21, 2015 at 09:55 PM
I want to calculate a total of values for selected options for a drop down field. The drop down fields has the "allow multiple" attribute. When I select a single choice in the field, the calculation field (Total M or Total G) gives me the correct value from the values list. However, when I select multiple items from the "My Thursday, Sep. 25 (TWD)" field, I get a calculated value that is not the total of the ones selected. (not sure what the number is). How can I get the total of the items when multiples are selected?
I am doing prototyping to evaluate ease-of-use changes to a form that I have used for several years. So far, the form only has the changes in the fields mentioned above. Also, I have not put in all the drop down values, the list of values is currently not as long as the list of drop down options. However, in my testing, I have only chosen options that correspond to values in the value list. I hope this prototyping shortcut is not causing the problem.
An additional question: If you read the text in the various options listed in the drop down field "My Thursday, Sep. 25 (TWD)", you'll see that there are actually two prices associated each option. Is there a way to have two (or more?) values for each option. One choice is to duplicate each option putting a separate price (member or guest) on each, but this gets cumbersome because the list that the user sees doubles insize. Is there a better way? I do have some constraints in what I do because I have extensive VBA coding that reads the Excel workbook of submissions. I'd prefer not to be forced to make extensive VBA changes.
I did test your form and I am able to replicate the issue you are having. It seems if the "Allow Multiple" option is enabled in dropdown question, the form calculation widget does not calculate for multiple selected options.
Let me report it to our back end team. We will get back to you as soon as we have any update form them.
For now, I would suggest you a workaround which should solve your problem. Here are the steps you should follow:
1. Add one textbox for every dropdown options you have added. You can hide these textboxes as it will only be used for calculation.
2. Add condition in your form to update the value of the these based on the selection of dropdown options. The following guide should help you: http://www.jotform.com/help/268-How-to-Insert-Text-or-Mathematical-Calculation-into-a-field-using-a-Condition
3. Add "Form Calculation" widget in your form and set it to display the sum of all the textboxes. Please check the screenshot below for all the steps:
Thanks for you help. I hope your developers can add the function to allow the values to be referenced when "allow multiple" is used in a drop down because the work around is quite cumbersome. If I choose the method you quite ably demonstrated with the animation, I will have 23 drop down enrollment options for each of 11 drop down fields (corresponding to the weeks of my camp). That will require putting 252 hidden fields. Creating this would be unmanageable; maintaining it will would be a nightmare. Plus, I haven't mentioned that there is another dimension (guest or member fee amounts) which would double the requirement to over 500 fields.
I must admit though that picking up values on an "allow multiple" drop down has it's own challenges for YOU guys. What do you do with the multiple values. I obviously want the sum of the selected values, but perhaps you would have to provide something more general to allow the form designer to select sum, average, max, min, or etc??
Please keep me posted on what your programmers say.
I can understand the situation where you have several dropdown options, it will not be practical to add so many textboxes. My workaround solution will work if you have limited options in dropdown question.
I have already reported it to our back end team and it seems one of our developer is already looking into this issue with priority. We will get back to you as soon as we have any update form him.
Wow! Thanks to the support and back end teams! I used it in my prototype and it works!
On behalf of JotForm's support and development teams you are most welcome.
Glad to see that your issue has been resolved, if you are in need of further assistance feel free to contact us.
I am having similar issues. I have multiple products with varying prices. I have entered drop down boxes for quantities 0-10 in some cases. This is a new issue as the form was working correctly last week or so. Now, when a check is placed next to the product name and the quantity is still listed as "0", it returns the price per 1 item in the box.
Here is the page address: http://www.jotform.com//?formID=52004713503946
Any help is greatly appreciated,
Please be noted that you should create a separate thread for unrelated question. Your question is different form the topic of this thread as you are having issue with your payment field.
For some reason I am unable to move your question to a new thread so I will go ahead and answer it here. I did check your form and I am unable to replicate the issue you are having. The total amount does reflect the changes based on the selection of the quantity dropdown options. Please check the screenshot below:
Have you embedded your form in any web page where the calculation is not working? Please share the web page URL and we will take a look.
The issue could be related to some code conflict between your form script and other script available in your web page. Embedded your form using its iFrame embed code will solve this issue. The following guide should help you grab your form's iFrame embed code: https://www.jotform.com/help/148-Getting-the-Form-iFrame-Code
We will wait for your response.