JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
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.
Form Collapse, Conditions, and Calculations not playing well together...Asked by OVUForms on May 28, 2015 at 02:44 PM
I have a specific issue on a form I am currently working on...
This is a registration form that needs to allow someone to register up to 4 additional participants. Each additional registrant is asked for a full name (text field), t-shirt size (drop-down), and a registration fee (radio buttons) of either $50 or $25 depending on age. I have all of that set up and working nicely. I even have the different registration costs feeding into a total that is set up to go to PayPal. This is all working as it should.
Now the conditions are set up so that the person filling out the form will first indicate "Yes" or "No" if they want to register additional people for this event. If they click yes, they get another field asking how many (a drop down with up to 4). Depending on what they choose in the "How Many" drop down field, it will reveal up to 4 registrant sections. Each of these additional registrant sections (the full name, t-shirt size, registration fee fields mentioned earlier) is set up in a Form Collapse. So the conditions say, if "1" is selected in the "How Many" drop down menu, then show "Section: Registrant 1", if "2" is selected, show Section 1 and Section 2, if "3" show Registrant 1, 2, and 3, etc...
Showing Section: Registrant #1 works fine after selecting "1" in the drop down. After that things get wonky. Basically Registrant #1 STOPS showing if I select any other options. If I select 2, it only shows Registrant #2 (it should show #1 and #2), if I choose 3 it shows Registrant #2 and #3, and if I choose 4 it shows Registrant #2, #3, and #4... so it's almost working correctly accept that I can't get the form to show Registrant #1 in any of the other options.
Attempts at Troubleshooting:
I've been messing with this for a little while, and have found one way that I can get Registrant #1 to show up with all the others. If I set the condition for selecting "1" in the drop down to show the beginning and ending form collapse for Registrant #1, then it will show for all the others. Two things weird about that... 1) I don't have to do this for any of the other sections, so I have no idea why Registrant #1 is so weird, and 2) When I do this, it messes up the calculation fields (why? I don't know). Basically, if I do this, then on the user end if someone puts in let's say 3 registrants and selects fees for them and then changes their mind to just 2, the now hidden Registrant #3 section is still adding to the total. This is despite having all the "ignore hidden fields" checkboxes set up properly--which can be attested to since whenever the form is NOT showing Registrant #1 correctly, the calculation fields all work as they should.
So, can you help me solve the case of the missing "Registrant #1?" Something about my conditions, calculations, and the form collapse for that particular section is acting strange.
I changed the condition for the first registrant a bit to allow for it to show up. Your setup should have worked but for some reason, this setup did:
If you force the field to show if any of the selections are made, the fields to for the first registrant are shown now matter which one is selected.
Here is my test form to show you it working:
If you have any further questions, let us know and we will be happy to help.
I just took a look and initially it seemed like it was working, but for some reason, this is now effecting other conditions and calculations. :/
For instance on your revised form, if the person filling out the form checks "Yes" for "Do you wish to register anyone else" and chooses any of the dropdown number, includes any of the registration fees and then changes their mind and clicks on "No" for "Do you wish to register anyone else?" those hidden registration fees still show up in the total.
Another weird thing: if they specifically choose 2 registrants, fill out the registration fees and then change their mind and click "No" for "Do you wish to register anyone else?" Not only do the fees stay present in their respective calculation fields, but Registrant #1 and #2 stay visible even though they should have been hidden when "No" was selected for "Do you wish to register anyone else?" See screenshot:
There is also a weird--and apparently "Firefox Only"--error on the revised form where if I choose some registration fees and then hit the browser "refresh" button the form calculations lose the registration fee information despite still being selected (see screen shot). Refresh should reset the whole form, hiding all conditionally exposed fields and resetting selection. This works correctly on my original form (even in Firefox).
First screen grab missing regarding Registrant #1 and #2 sections still showing even after selecting "No" on "Do you wish to register online?"
Here it is:
To fix those issues, I added another condition to hide the first registrant and placed it above the condition that shows the first registrant to give it priority:
To solve the equation issue with the fields still being filled when they are hidden, under the preferences tab in the Advanced settings, you can enable the "Clear a Field on hide" option:
This will clear the selections made in any fields that are hidden.
Here is my updated form:
Thanks for your continued work on this. However, setting this up to clear fields on hide creates more problems...
If you set this up to clear fields on hide, then if someone picks 1-3 registrant, fills in that information and then decides they want to do another registrant (or more), selecting a new number clears the initial fields filled in... same thing happens the other way around... if someone fills in 2-4 registrants and then decides to drop down to fewer, everything they've entered for the registrants gets cleared when they select a new number. That isn't very user friendly and defeats the purpose of "Ignore Hidden Fields" in the calculation fields. I would prefer to not have to clear fields on hide.
My concern with these workarounds so far is that they are seeming to beget more problems. My original setup had everything working fine, except that pesky Registrant 1. I feel like if we solve that--which, we agree should be working, we will have this form ready for prime-time.
I did a bit more work with your original form and I was able to get things working with a couple minor changes.
First, delete your condition that shows only the first registrant. Next, duplicate the second registrant condition. This should place a duplicate of the second registrant condition at the bottom of the list. Then, alter the duplicate at the bottom to only show the first registrant based on the "1" option:
This allowed for all the conditions to work.
Good call, we are SOOOO CLOSE!!! That worked to get #1 showing properly. Apparently the problem was that I needed to have it set to "Show Multiple" and then just choose section 1. So even though I wasn't selecting multiple fields for that condition, it needed to be set to Show Multiple. It even works when the condition is placed in the proper order.
The problem now though is that while that is fixed, it has now messed up my calculations which are no longer ignoring on hide... so if I enter registration fees for 2-4 people, but drop the registrant list down to a lower number, the calculations still holds on to the hidden costs.
I don't want to clear on hide because that creates problems for the user. We know that the "ignore on hide" selection SHOULD be working for my calculations... so how do we resolve that?
Just so you know, I'm troubleshooting some options, so if you come and find my conditions all wonky, that is why...
The troublesome part is that the conditions work just fine when the Section 1 doesn't show properly. As soon as we get that to show up the right way, the conditions stop working...
EUREKA!!! I DID IT!
I am not sure what was wrong, but I ended up just deleting and recreating the registration fee for registrant #1 and the calculation for registrant #1 and that did the trick!
Glad to hear it! Sometimes conditions can operate in weird ways when multiple conditions reference the same thing. If you had updated your field at some point as well, the conditional statement may have been buggy. If you have any further questions, just let us know and we will be happy to help.