When we want to use our Relationship Form to create new connections between posts in a many-to-many relationship, we can insert it directly into any page or a template.

Please note that Relationship Forms are used to connect existing posts that are already in a many-to-many relationship. They are not used to create new posts.

Connecting any Child Post to any Parent Post

Sometimes we may want to allow users to select posts from both “sides” of a relationship. For example, we might create a page called “Add Tracks to an Album” and insert our form into it. The following diagram explains this.

Relationship form for connecting any two posts
Relationship form for connecting any two posts

  1. Create a Forms Relationship Form.
  2. Edit a page on which to use the form and click the Toolset Forms button. Select our form in the Relationship forms section.

  1. An insertion dialog for our Relationship Form appears. Select what the form will do. In our example, to allow users to add any song to any album, we select “Connect between any Album and a Song” and click Insert shortcode.

In this manner, users will be able to select posts for both the parent (album) and child (song).

Connecting Child Posts to a Specific Parent

In many cases, we will already know one “side” of the relationship. For example, when displaying a single-album post, we might add a link to “Add New Songs to this Album.” Thus, the album side is “known”; it is the album we see right now. Therefore, in this case, we allow users to add any song to a preselected (i.e., the current) album.

In this case, it makes sense to include a link to this form in a template. When users click on the link, they will be taken to a separate page where they can add songs to the current album. The following diagram illustrates how this works.

How Relationship Forms for connecting any two posts work
Templates for forms used to connect one post to another post

Use the following steps to create this type of Relationship Form:

  1. Create a template for displaying single-album (parent) pages.
  2. Create a new Relationship Form and follow the wizard to select its settings and content.
  3. Create a template that is not assigned to anything and insert only the newly created Relationship Form. If you are using Toolset Layouts, do this by inserting a Forms Relationship Form cell.
  4. Edit the template created for displaying single-album pages and click the Toolset Forms button. If you are using Layouts, insert the Visual Editor cell and click the Toolset Forms button inside that cell. Insert the link to the newly created Relationship Form.

  1. In the form-insert dialog, use the second option, Connect a Song to a given Album. In the options beneath, select Link to an existing Content Template that contains the form (if you are using Layouts, it will say “Layout” instead) and choose the layout you created in step 3, above.

We are finished! Now, when users view any parent post (album), they will be able to connect new child posts (songs) to it.

What’s next?

Editing Existing Connections between Related Posts