[Resuelto] Insert repeatable fields edit form inside main post edit form?
This support ticket is created hace 4 años, 10 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
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!
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.
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?
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.
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:
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]']