Skip Navigation

Front-end Forms For Repeatable Field Groups in WordPress

You can use the Toolset Forms plugin to create front-end forms for submitting and editing post information using repeatable field groups.

When you create repeatable field groups  they will appear as a separate post type when creating the form. In Toolset, front-end forms are created using the Forms plugin.

When you create repeatable field groups they will appear as a separate post type when creating the form. For example, let us say you have a post type called “Houses” and a repeatable field group for “Rooms” that belongs to each house. You can create a separate form that allows users to add “rooms” to existing houses.

To use Toolset forms to edit existing data that comes from repeatable groups, you need to display the form in a View that lists repeatable field groups.

Creating a Form for Repeatable Field Groups

To create a form for creating repeatable field groups, use the following steps.

  1. Go to Toolset → Post Forms and click the Add New button.
  2. After naming your form, use the Post type to create/edit option to select your repeatable field group.

Please note that the status of content created using forms for repeatable field groups can only be that of “published.”

  1. Select what happens after visitors submit this form. A good option is to keep displaying the form. This will allow users to add more repeatable field groups. Please note that currently, there is no way to add multiple repeatable field groups from one front-end page (in one go).
  2. Forms drag-and-drop editor will automatically create a basic form for you. Please note that only if you mark the fields from your repeatable field group as required, they will be automatically added to the form. Otherwise, use the editor to manually add fields from your repeatable fields group.

Forms that submit information using repeatable field groups must feature a field to select the parent post. Otherwise, the submitted information cannot be retrieved and used. This field is automatically included in the form, just make sure not to remove it.

  1. When done, click to finish and save your form.

You can now use the Toolset Forms Block to insert the form into any page and allow users to submit information using the repeatable field groups.

Forms for Editing Values of Existing Repeatable Field Groups

To use Toolset forms for editing values of existing repeatable field groups, you need to first create your editing form. Then, you need to create a View that lists your repeatable field group and add a link to that editing form. To do this, use the following steps:

  1. Go to the Toolset → Post Forms page and click the Add New button.
  2. Give your form a name, select the Edit existing content option, and under Post Types to create/edit option select the repeatable field group. Adjust other form options as needed.
  3. Forms drag-and-drop editor will automatically create a basic form for you. Please note that only if you mark the fields from your repeatable field group as required, they will be automatically added to the form. Otherwise, use the editor to manually add fields from your repeatable fields group.
  4. Next, you need to create a « container » Content Template that only holds the editing form you just created. Go to Toolset Content Templates and click the Add New button. Give the template a name but don’t assign it to any post type. Instead, simply insert the Toolset Form block and select the editing form you created. Save the template.
  5. Now, create or edit a Content Template for displaying single posts that belong to the post type in question. For example, if you have a repeatable field group for a custom post type called « Rooms », you need to create or edit the Content Template for single room posts. Insert the View block into this Content Template and when choosing which content it should display, select your repeatable field group.
  6. You can add whatever blocks you want to the new View. However, you must also add the link that will allow users to edit any repeatable field group. To do this, insert the Toolset Fields and Text block, click on its Forms icon, and click to insert the Edit post link. In the pop-up dialog that appears, select the « container » Content Template you created in Step 4 above.
  7. Finally, save the template for displaying single posts to which you added the View.

That’s it! When you view these single posts on the front-end, they will list all their repeatable fields. Next to each repeatable field, there will be a button to edit it.

Main Toolset Block Used in this Lesson

Créez des listes de publication personnalisées

Updated
mars 29, 2022