Skip Navigation

[Resolved] edit repeatable group on page

This support ticket is created 3 years, 9 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1706423

dear support,

I am using a custom post type including a repeatable group.
I created a page including two frontend forms to add data to the custom post type and a second form to add the data to the repeatable group since I haven't found a solution to add the repeatable group directly into the custom post form.
Anyway the creation process works fine, but I haven't found a good way to edit this. I created a page where both the form for the custom post type and the form for the group are placed. But when I link this page it does not know what custom post I am referring to.
How do I achieve this?

The second best option would be to add a separate "button" to only edit the data of the repeatable group.
So if option one is not possible, how would I do this? Somehow the insert edit link did not work although I added a template for this.

#1706971

I created a page including two frontend forms to add data to the custom post type and a second form to add the data to the repeatable group since I haven't found a solution to add the repeatable group directly into the custom post form.
Hello, you are correct about this limitation - the current software requires separate Forms for creating the parent post and creating a Repeatable Field Group (RFG) in that post. Normally you must create the parent post first, then add its RFGs after that. The editing process is also split into multiple parts - you will edit the parent post and each row of the RFG in separate Forms. One Form can edit the parent post, or it can edit one row of the RFG - not including any nested RFGs, since those must be edited in a separate Form.

I created a page where both the form for the custom post type and the form for the group are placed. But when I link this page it does not know what custom post I am referring to.
The preferred process for editing a post with Forms requires you to insert the edit post Form in an unassigned Content Template. Then you can create a link to edit that editor template using the Fields and Text block in the Block Editor, as described in this documentation: https://toolset.com/course-lesson/front-end-forms-for-editing-content/
To edit an individual row of the RFG, you will follow the same process. Create an unassigned Content Template and insert the Edit RFG Form there. Back in the front-end single parent post, you probably have a View that loops over the RFG. That's a logical place to add the edit link with the Fields and Text block.

Somehow the insert edit link did not work although I added a template for this.
Can you tell me more about how the link was broken, specifically?
- How did you insert the edit link? Please show me in the Block Editor, or if you're using the classic editor, copy + paste shortcodes and other markup here for me to review.
- Where did you add the link in wp-admin, and did the link appear on the front-end?
- What was the URL of the link destination?
- When you visited the link, was there a broken Form displayed, or an empty page, or a 404, or something else?

#1708517
editlink_workflow.jpg

Thank you Christian for your help!

Hm, so I'll go with the two different edit forms. That should be fine.
But for some reason, whenever I enter the link to edit the RFG no text and no link appear.
This is my workflow (Screenshot).

There is no difference to what I did to enter the main form edit link. So I am not sure where I have to change something.
I also tried to set it to parent relationship but got the same result.

#1709037

Okay thanks for the pics. I don't see anything obviously wrong in your setup, so something else must be going on. It could be an Access/permissions issue. When you test on the front-end of the site, are you testing as a logged-in, admin-level User? If not, please test as an admin. If the link appears it's probably just a configuration issue in Access settings for the Form.

If this isn't the issue, I would like to rule out any problem in the Fields and Text block. In your screenshot area #4, you can see the shortcode written out. I can't see the full code but it starts like this:

[toolset-edit-post-link content_template_slug="...

As a test, please copy this code and paste it in a Paragraph block, then remove the Fields and Text block. Let me know the results.

#1711019

Thanks Christian for your answer.
I tested as an admin and as a regular user. It is not visible in any way.

Here is the shortcode:
[toolset-edit-post-link content_template_slug='partnergallerie-bearbeiten' target='self']Partnergallerie bearbeiten[/toolset-edit-post-link]

I hope this will help to find a solution.

#1711769

Okay based on the code you shared, there should be an "unassigned" Content Template with the slug "partnergallerie-bearbeiten". That Content Template should include the Edit Post Form that edits your RFG. If this is the case, but the link still does not appear as expected, I may need to take a closer look. Please provide login credentials here in the private fields and let me know where I can see this View on the front-end of the site.

#1712781

Okay I see here you have a View of Angebote posts. Since each Angebote post can have multiple RFGs, you would need some way to loop over each row of those RFGs and display links to edit each one. That would require a nested View, which isn't currently supported in the Block Editor. You could add a View of RFG in the Content Template applied to Angebote posts: hidden link
Then place your Edit Post link inside that View to edit each row of the RFG. That's the best way to accomplish this with the Block Editor. Otherwise you'll need a classic Views approach to allow nested Views in the View of Angebote posts.

#1713511
cooperation.JPG

Hi Christian,

thank you for your input.
But somehow the whole solution with the RFG is not satisfying. The way it is displayed in the Angebot-Template is perfect, but if I can not let the user edit in relation to the Angebote-Post it will be very hard for them to understand how these things are connected together.
Maybe I should go one step back and there might be a much better solution to all of this.
My goal is that my user can add one or more partners (Logo, cooperation type, URL) to a custom post (Angebot). And they get displayed in some sort of gallery below their offer (Angebot). It can also be that there is no partner for a certain offer (Angebot). That is how it is right now. (Screenshot: cooperation)
So the output is fine.

But the way for the users to add this partner gallery is not very straight forward. First, they need to add it through a specific form (not the Angebot-Form) Although they are linked directly to a specific "Angebot". Second, the workflow to edit partners seems to be even worse. Since they are not connected to the offer but would be listed all together.
Editing them in the template that you recommended is not a good solution either since only the owner should be able to edit them.

So do you see a good alternative solution for what I try to achieve? If not is there a condition to only show the edit and delete options to the owner of the partner-gallery?

Thank you.

#1713827

So do you see a good alternative solution for what I try to achieve?
I think you're using the only approach that is functional in the current system. You're describing a known usability issue related to a limitation of Forms - only one post or one RFG can be added or edited in a single Form. It makes the RFG management process clunky and disjointed. Our developers are working on ways to improve the workflow of managing posts and repeatable field groups, but for now it's a limitation that does not have a simple workaround in the Block Editor, only complex custom code solutions that require knowledge of PHP and JavaScript.

A second limitation you've noticed is that it's not possible to create a nested View of RFG inside a View of its parent post type, which limits your ability to easily display "Edit" links next to each RFG row. That's a more complex issue to resolve in the Block Editor, and our developers haven't yet tackled that one. I can help you set this up in a classic View if you'd like, and that would give you the ability to display a View of the RFG inside the View of the parent posts, and display an "Edit" link next to each row of the RFG. That would make it easier for site Users to understand how to edit each row.

If not is there a condition to only show the edit and delete options to the owner of the partner-gallery?
You can use Toolset Access to manage permissions for editing or deleting with Forms to prevent this problem without the need for extra conditionals. You can configure the permissions such that only post owners have permission to use the Edit Forms or delete these RFGs, and that will adjust visibility of the links accordingly. There is a tab in Toolset > Access Controls for Forms, where you can manage these permissions, per User role.

#1715541

My issue is resolved now. Thank you!

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