Hello,
I use Formidable Forms for creating posts. Everything work well, I can associate Data to custom fields. Now I added to the form repeatable fields of name , surname, email affiliation and country of team members. I need a manual function for adding the content to repeatable groups.
So use the function frm_new_post hidden link to create the assossiation. From the form I get an array like this (I could also format it different if needed):
Array
(
[0] => Array
(
[wpcf-name] => Lili
[wpcf-surname] => Bety
[wpcf-email] => test@test.dir
[wpcf-affiliation] => None
[wpcf-country] => Oman
)
[1] => Array
(
[wpcf-name] => Second Test
[wpcf-surname] => dss
[wpcf-email] => kla@dni.cs
[wpcf-affiliation] => Neto
[wpcf-country] => Uganda
)
)
I want to add it to the Post Fields group "team-members" with the corresponding repeatable fields for name , surname, email affiliation and country
Is it true, that I have to add a child post for the repeatable group? Which function should I use for that?
Hi,
Thank you for contacting us and I'd be happy to assist.
Your understanding is correct. The repeatable field group items are stored as separate and hidden custom post-type entries, and the post-type slug is the same as the slug of the repeatable field group. This post type has a one-to-many relationship with the parent post type.
(i.e. the post type in which this field group has been added)
You'll find an example usage of a function to programmatically add repeatable field group items, in this recent thread:
https://toolset.com/forums/topic/php-add-repeatable-fieds/
regards,
Waqar
Thank you Waqar. You brought me on the right track. Thank you for posting a solution. Actually I needed another function from Formidable forms to accomplish it. The function frm_new_post does not know the post id so i could not use it for toolset_connect_posts() function. But I could sucessfully use this function hidden link