Skip Navigation

[Resolved] Adding multiple items to a field group with one form

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 1 voice.

Last updated by Minesh 1 week, 4 days ago.

Assisted by: Minesh.

Author
Posts
#2796495

I have a cpt with a repeatable field group. I created a form to add items to this repeatable field group. I'd like to be able to add multiple items to this field group at once. I think I read a while back that this was impossible, but I cannot find those posts now. Is it possible?

If impossible perhaps I could just add the form multiple times on the page, hide the submit buttons, and create one button that submits all the forms at once?

Thanks,

Tim

#2796496

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Repeating field group is managed as one-to-many post-relationship internally. So, each item of repeatable field group is managed as a single post. While using Toolset form you can create/edit only one post in each form, it can not create the multiple posts in one Toolset form.

That is why you need to create a new form to create a new entry for repeating field group.

Please check the following Doc and try to follow the steps:
=> https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/front-end-forms-for-repeatable-field-groups/

The solution you shared is not going to work as if you add the same form multiple times it will have duplicate fields and not going to work.

I suggest - you create a single form and then use generic fields. I found one of your ticket that may help you:
- https://toolset.com/forums/topic/saving-repeating-field-group-with-generic-fields/

More info:
- https://toolset.com/course-lesson/adding-generic-fields-to-forms/

#2796509

Thanks, but I have the form already working fine for adding one item. Are you saying that if I use generic fields I can add multiple items?

Tim

#2796510

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - but you will have to write custom code to add those additional entry.

For example - something like - if you want to create 2 more entry using your existing form then - so 1 entry using your oringal form and another two entry using the generic field. You can catch those generic field value using "cred_save_data" or "cred_submit_complete" hook and create new posts.

  <label>Post title 1</label>
   
    [cred_generic_field type='textfield' field='post_title_1']
    {
    "required":0,
    "validate_format":0,
    "default":""
    }
    [/cred_generic_field]
   [cred_generic_field type='textfield' field='post_title_2']
    {
    "required":0,
    "validate_format":0,
    "default":""
    }
    [/cred_generic_field]

Please check the following ticket that might give you idea:
=> https://toolset.com/forums/topic/using-woocommerce-and-cred_save_data-to-create-a-custom-post-type/