Show certain number of text fields, based on answer

  • allustrious
    Asked on July 26, 2016 at 7:55 AM

    I am trying to create a field on the form that will allow a person to choose the number of people attending their conference, so they can list their names.

    In other words, I will have a question that will read:

    "How many students are planning on attending?"

    And, if the user types or selects 5, then I want 5 empty text fields to show, so they can enter the name of each student that will be attending.

    Is this possible with JotForm?

     

  • Charlie
    Replied on July 26, 2016 at 10:05 AM

    There are two options that you can use here:

    Option 1: The easiest. You can use the widget fields that allows your users to dynamically add fields. You can try the following widgets:

    Configurable List Widget 

    Infinite List widget 

    The most advance widget that we have for this job is the Configurable list widget, here's a guide that you can refer to: https://www.jotform.com/help/282-How-to-Set-Up-the-Configurable-List-Widget 

    To add a widget on your form, you can follow this guide: https://www.jotform.com/help/252-How-to-Add-a-Widget-to-your-Form 

     

    Option 2: You can use conditional logic to set specific fields to hide or show depending on the user input. To learn more about this, you can check this general guide: https://www.jotform.com/help/57-Smart-Forms-Using-Conditional-Logic. Example, if the number of participants is equal to "5", then show the 5 hidden fields for full name. The problem here is that you need a maximum number of participants that can only be entered.

    Here's an example form: https://form.jotform.com/62074188314960. Here's how it is setup:

    1. I have setup a number field for the number of participants. I then have multiple copies of full name field, these are only shown if the conditions are met. 

    Show certain number of text fields, based on answer Image 1 Screenshot 30

    2. Here are the conditions. 

    If "Number of participants" is equal to "1", then show "Name 1".

    If "Number of participants" is equal to "2", then show "Name 1" AND "Name 2".

    If "Number of participants" is equal to "3", then show "Name 1" AND "Name 2" AND "Name 3".

    ... and so on.

    Show certain number of text fields, based on answer Image 2 Screenshot 41

     

    You might be asking, why there are no conditions to HIDE them? This is because the fields will automatically be hidden if the condition/s are NOT MET, so no need to actually setup separate conditions to hide the fields.

    I hope that helps.