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.
How to set conditional logic to show and hide fields depending on the quantity field?Asked by danamorgan on May 21, 2015 at 07:42 PM
I setting up a race entry form and was trying to do it so it only needs to be filled out once for each family rather than one per person. I've set up my paypal to allow for selecting# of participants in each category. What I want to do next is have the same number of "name" and "t-shirt size" fields displayed as the quantity selected. So for example if they select 2 adults and 3 kids, then 5 sets of name/t-shirt would then be displayed.
For the 2nd part of this we offer a family pack, and I'd like them to enter the # of people in their family and have the same number of fields be displayed.
Is that possible?
I've attached the in progress link to my form.
quantity selected Other field entry form name
I'm trying to use conditional logic, but it's just not quite right. Here is what I did, but the number of runners isn't updating.
Rather than adding the categories and quantity to the payment wizard, you can create them manually using plain form fields instead. From there, you can use Conditional logic and/or Form Calculation widget to pass the calculated price to your Payment total field.
I've cloned your form and made my edits in my end: http://form.jotformpro.com/form/51408608102951. If you want to clone mine and explore it, you can by following this guide: http://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL. Here are the steps on how I did mine:
1. I set up a radio button for the selection of Race Category.
2. First, explore the conditional logic on how to show and hide fields, I assume you already know this as I see you implemented it in your form.
3. I'll then use conditional logic to pass a value and the form calculation widget to calculate the prices. Here's an example:
For the "Individuals", I'll use the Form Calculation widget get the number field for Adult and Child, then calculate depending on the price specific for each. Here's a guide on how to do a form calculation: http://www.jotform.com/help/259-How-to-perform-calculation-in-the-form
For the category family, I assume it's a fix $75.00 USD, so what I did is use conditional logic to insert that price to my "Final Total" field.
Here's the complete list of conditional logic I have.
4. After that, we want to pass the final total price to the payment wizard, you can follow this guide on how to do that: http://www.jotform.com/help/275-How-to-pass-a-calculation-to-a-payment-field. Here's mine:
For the list of names and runner, I think it's better to use a dynamic widget that lets you enter multiple entries, you may check a list of it here: http://widgets.jotform.com/category/multiple_entries. The most customizable widget there is the Configurable list widget. Here's a guide for that widget: http://www.jotform.com/help/282-How-to-Set-Up-the-Configurable-List-Widget.
I hope that helps. Do let us know if you need more help on this.
I forgot to mention, this version of the form will let you better use the conditional logic to hide and show different fields depending on the quantity field because they are now plain form fields. The quantity field in the payment wizard can be use in conditional logic but has some limits on them.
But see which one suits you best.
This was fantastic and exactly what I was looking for. Thanks so much!
On behalf of my colleague, Charlie, you are kindly welcome.
Please contact us again if you have other questions or need any help, we will be happy to assist you.