Skip Navigation

[Résolu] Insert repeatable fields edit form inside main post edit form?

This support ticket is created Il y a 4 années et 2 mois. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 réponses, has 2 voix.

Last updated by Ido Angel Il y a 4 années et 2 mois.

Assisted by: Nigel.

Auteur
Publications
#1457931

Hey,
I want users to be able to edit repeatable fields from the frontend.
I have to repeatable fields groups and have created a cred form for adding each of them.
I tried inserting the 2 repeatable fields cred forms into the main edit-form content template, but this resulted in an error (it made the edit-post link disappear).
I tried inserting these forms into the post editing form, but that didn't work either.
What's the proper way of getting this done?
thanks!

#1458075

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ido

These workflows are a little awkward, but you need to think of repeatable field groups in the same way as child posts.

So, you have some post type (the parent) to which the repeatable field group belongs. A hidden child post type is created to hold each instance of repeatable fields.

If you create a form to edit fields of a repeatable field group that means making one form for each repeatable field group, and adding each such form to its own content template to act as a container, and then inserting an edit post link, but the context for that link needs to be the repeatable field group post itself.

So imagine you have a template to display the parent post, and you add a View to show the repeatable field groups belonging to that parent. Well, the output section of that View is the place to insert such an edit post link that has the correct context.

#1458083

Hey Nigel!

Yes, I get the workflow 🙂

What I don't get is this:

I have a content template for the cpt. I have a page with a create-form for creating the cpt. So far so good.
I have 3 other forms:

1. edit form for cpt
2. edit form for repeatable group A
3. edit form for repeatable group B

1 is hosted in a content template.
but 2 and 3 aren't, as I want the user to be able to create the repeatable groups when editing his cpt.

I tried:

a) placing 2 and 3 inside the cpt content template
b) placing 2 and 3 inside the cpt editing form (1)

none worked.

Should I create 2 more content templates for form 2 and 3? will i have to add edit links to each? doesn't this mean I wiyld have to edit them separately from the actual cpt?

thx!

#1459353

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+00:00)

You have 2 & 3 which are edit forms for RFGs, but don't you have forms to publish RFGs?

You need a form to publish the parent post.
Submitting that redirects to display the post.
The template for that post includes a child post link to the form to publish RFG A, and another link to the form to publish RFG B, each of which you are likely to want to redirect back to the parent post.

For editing purposes you need 3 separate edit forms (parent post, RFG A, RFG B), and any edit form must be hosted inside its own content template.

The template for displaying the parent post would include a link for editing itself, plus it would display the RFGs using Views, and the output of those Views would include edit post links for the RFG.

The workflows are undeniably awkward, and the original intention was to update forms to be able to publish RFGs from the same form used to publish the parent post, but this work got sidelined by other priorities, and so I would encourage you to submit a request at https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/ so the product manager is aware of the demand to complete it.

#1459449

Hey,
No - I have 2&3 for creating RFGs, not editing them - but I want to place them inside the main cpt edit form, so that the process will be:
1) user created the main (parent) cpt
2) he can now edit it + add RFGs to it
What I did is, in the end, I entered the "add RFG" forms into the content template for the parent cpt, and made sure it is shown only if the author of this post is the current user, like this:

[wpv-conditional if="( '[wpv-post-author]' eq '[wpv-current-user]' )"][cred_form form="articles"][/wpv-conditional]

In the RFG forms I made sure the RFG belongs to the current post by making the value of the parent post equal to the current post like this:

[cred_field field='@lawyer-rulings.parent' class='form-control' output='bootstrap' select_text='--- not set ---' author='$current' value='[wpv-post-id]']

Seems to work!
Thanks for this, Nigel!
Ido

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.