For example I want to have a parent section with their name address, sex, male for female radio button, etc.
Then be able to add ‘X’ number of children with their name, sex, education via a drop down, interests via checkboxes. And then repeat until all the children are input.
The gf_list field type only allows text boxes.
I would be amiable to like ask How many children do you have then loop thru the fields that many times.
The only way I can see to do it is to create a finite number of sections or pages and then ask do have more, yes or no and use conditional logic on each section or page. But that then limits the number. Albeit 10 children is a lot in today’s world.
Your help is appreciated, Rick
You can programmatically add a Repeater Field to your form, which will do just what you need: Repeater (beta) - Gravity Forms Documentation If you need help getting your repeater set up, let me know!
Thanks for the reply. Yea I’m going to need a little help. I am an old programmer so I’m not afraid of coding.
This is exactly what I need.
I copied the Example 1 sample code and tried to create a test form, but can not figure out where to put the code. Do I need to create the fields first and then attache the code to one of them. Thanks for you help.
Rick
Does the whole form need to be created using code? Or can the repeater field code be attached to a field, form property, or a separate field? Like I said I copied the example 1 code but if I put it in an html filed it just shows up as code in the form when I do a preview.
Your help is appreciated.
Rick
Morgan has you on a solid track.
If you want to learn about some alternative approaches, we have an article here:
There are two ways you can run this code: (1) put it in a PHP file somewhere, or (2) use a code snippet plugin.
If you want to put it in a file somewhere, you can either put it in your theme’s functions.php file, or you can create a plugin in your WordPress plugins directory.
Using a code snippet plugin is the easier approach. I like this one: Code Snippets – WordPress plugin | WordPress.org
You do not need to create the whole form with code. The code in Example 1 will add the repeater to an existing form: in that code, if you change the 149 in gform_form_post_get_meta_149
to be the ID of your form, it will add the repeater to your form.
Feel free to post your code here if you’re having trouble getting it working, and I can help!
If you’d rather not mess with code, Gravity Wiz’s Nested Forms plugin is a very good solution as well.
Thanks for Ya’lls input. I’m afraid I am stuck. My site is hosted by Diocesan Publication Inc., using Wordpress. So I am not the Admin and do not have access to Snippets. I know what that is. I have another site I maintain that uses them. And buying an add-on is not in our budget, nor probably available from DPI. I’m going to need to contact DPI and see if they will do that for me. Thanks so much for your time. Rick
I asked DPI if they could do the code that was suggested for Repeater Fields. She didn’t know anything about Repeater Fields but did a search and found a plugin: Repeater Start and Repeater End fields that she added to the Advanced Fields section. And that worked beautifully. Here is a link to the doc: Document - Gravity Forms - Repeater Fields - Yee Add-ons