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: http://www.gravityhelp.com/documentation/page/Gform_column_input
To set the number of rows in a list item, you can use this approach: http://gravitywiz.com/set-number-of-list-field-rows-by-field-value/
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 11 years ago on Sunday March 24, 2013 |
Permalink