How to set conditional logic to show and hide fields depending on the quantity field?

  • danamorgan
    Asked on May 21, 2015 at 7: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.

     

  • danamorgan
    Replied on May 21, 2015 at 9:01 PM

    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.How to set conditional logic to show and hide fields depending on the quantity field? Image 1 Screenshot 20

     

     

     

     

     

  • Charlie
    Replied on May 21, 2015 at 11:16 PM

    Hi,

    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.

    How to set conditional logic to show and hide fields depending on the quantity field? Image 1 Screenshot 60

     

    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 

    How to set conditional logic to show and hide fields depending on the quantity field? Image 2 Screenshot 71

    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.

    How to set conditional logic to show and hide fields depending on the quantity field? Image 3 Screenshot 82

    Here's the complete list of conditional logic I have.

    How to set conditional logic to show and hide fields depending on the quantity field? Image 4 Screenshot 93

     

    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:

    How to set conditional logic to show and hide fields depending on the quantity field? Image 5 Screenshot 104

     

    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.

    Thank you.

  • Charlie
    Replied on May 21, 2015 at 11:21 PM

    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. 

  • danamorgan
    Replied on May 22, 2015 at 1:07 AM

    This was fantastic and exactly what I was looking for. Thanks so much!

  • Boris
    Replied on May 22, 2015 at 3:45 AM

    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.