PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Drop down list will create X number of input boxes?

  1. I am new here.

    Can you create a dropdown list that will dictate how many text input boxes will be created in the next question?

    For example.
    Question 1: How many kids do you have? <dropdown list showing 0-10 and user selects the number 3>

    Question 2: What are you kids names? <can the form generate only three text boxes here?>

    [user inputs kid 1 name = "Sally"]
    [user inputs kid 2 name = "Johnny"]
    [user inputs kid 3 name = "Billy"]

    If the form can do this, can it then in Question 4 auto-populate with names entered above?

    Question 3: What color hair does your kids have?
    Sally - <drop down for hair colors>
    Johnny - <drop down for hair colors>
    Billy - <drop down for hair colors>


    Posted 7 years ago on Friday March 22, 2013 | Permalink
  2. You can do this with conditional logic. It's not dynamic though: all the fields need to be in the form from the beginning, and you reveal the ones you want using conditional logic based on the drop down choice. This approach will not work if you do not have a finite number of choices. You showed 10, which would work fine.

    You will have the "number of children" drop down first, then based on that choice, you will show text field 1 if the selection was 1 child, show text field 1 and 2 if the selection was 2 children, show text fields 1, 2 and 3 if the selection was 3 children, etc. The conditional logic for field one will be to "Show this field if ANY of the following are true" and then you will have one rule for every drop down choice from "Number of children". There will be 10 rules for field 1, 9 rules for field 2, 8 rules for field 3, etc.

    For question 4, to copy the entered data to another field, you will need to use jQuery. There is no functionality in Gravity Forms to copy the value from one field to another, especially when trying to generate a new field.

    For question 3, you would use the same approach as for the number of text fields as detailed above. You would use a drop down instead of text fields. The logic is the same to show the fields though.

    Instead of all this approach though, maybe you could use a list field with two columns, name and hair color. You can ask a question "How many children?" and then based on that drop down you can show a certain number of rows, and the first column could be child's name and the second column could be hair color.

    You would need to use the Advanced Fields > List type field, and need to change the text input to a select box, for your hair color drop down:

    To set the number of rows in a list item, you can use this approach:

    The second approach seems easier to me than the first, using conditional logic, but may not work if you have additional requirements not detailed here.

    Posted 7 years ago on Sunday March 24, 2013 | Permalink
  3. Thank you!

    Posted 7 years ago on Sunday March 24, 2013 | Permalink
  4. You're welcome. We'll leave this topic open in case you need additional assistance.

    Posted 7 years ago on Sunday March 24, 2013 | Permalink