Tutorial requirements:

The JetEngine’s relations feature allows you to connect, create, and edit related items just on the editing page of posts, CCT items, users, and taxonomies.

But if you want to connect related items on the front end, you can do this via the form with the help of the JetFormBuilder plugin and the Gutenberg block editor.

Connect Child Objects to Parent Ones

Go to JetFormBuilder > Add New. Give the new form a title and leave the default settings of the Hidden Field block.

creating new jetformbuilder form

Click on the Toggle block inserter button and place the Select, Radio, or Checkbox fields to display the child items in the form. Be informed that the Radio and Select allow choosing one option and it suits the “One to Many” relation type, and the Checkbox allows selecting one and more options and it matches the “Many to Many” relation type, so we decided to drag-and-drop such Checkbox Field block to our form.

checkbox field block

Select the “Posts” as the source in the Fill Options From field and define the needed Post Type. As we want to choose the related children for the relationship “Country > Tours,” we have selected the “Tour” Post Type.

In the Block General settings, type the Field Label and change the Form field name.

NOTE

Be aware that all field names inside one form must be unique, and field names must contain a value with only lowercase letters in Latin, no spaces. If you want to split words, this can be done by using the “-” and “_” characters.

Press the “Dynamic tags” button in the Default Value field to open the pop-up.

checkbox field block settings

Pick the “Related Items” option in the Source field.

editing preset and choosing source

After that, you get the new additional settings:

  • From Relation. Define the relationship you want to use as the source;
  • From Object. Specify if you want to display children (Child object option) or parent (Parent object option) items;
  • Initial Object ID From. Indicate where the query will get the object ID from to display its related items in the form:
    • Current Object ID. Shows the related items of the current post, of the current active listing item, and so on;
    • Current User ID. Shows the related items of the currently logged-in user;
    • Queried User ID. Shows the related items of the selected user, e.g., on the User Page in the Profile Builder;
    • Query Variable. Shows the related items from the global request or WordPress request variables. If you select this option, the fourth Variable Name will appear;
    • Current Object Variable. Shows the related items from the object defined as current by JetEngine. If you select this option, the fourth Variable Name will appear;
    • Default WordPress Object (for current page). Always shows the related items of a current global object for the current page defined by WordPress, as opposed to the “From Relation” option.
  • Variable Name. This field appears if you select the “Query Variable” or “Current Object Variable” options. This option allows setting the variable’s name, which the plugin will search for in the query or current object.

In this case, we have picked the “Current Object ID” option in the Initial Object ID From field because we want to display the Tours child posts in the form on the Country parent post.

relation settings in the jetformbuilder

Press the “Update” button and move to the JetForm settings and the Post Submit Actions tab. Select the “Connect Relation Items” option and click on the pencil-shaped icon to edit the action.

connect relation items post submit action

In the new pop-up window, select the needed Relation. Pick the name of the Hidden Field (with the default “Current Post ID” option) as the Parent Item ID. As the Child Item ID, select the label of the created field for the related items (the Metabox in our case). Since it’s needed to display the children objects in the form, choose the “We updating children items for the parent object” option in the Update Context field.

edit action

Push the “Update” button to save this action and click on the “+ New Action” button to create a new one.  Select the “Insert/Update Post” option and hit the pencil-shaped icon under this action.

insert update post submit action

Select the parent post type that you want to update via the form in the Post Type field.

Select the needed Post Status or leave it empty. Also, leave the default Fields Map values.

As for the Default Fields, they are not needed in this case. So, once done, click on the “Apply Changes” button.

NOTE

Be aware that if you fill the Fields Map, the new related items replace the old ones instead of just being added to them.

edit insert update post submit action

Hit the “Update” button and publish or update the form to save the changes when you finish editing fields and actions.

To place the form on the parent object, proceed to the parent Post Type on the WordPress Dashboard and Edit the needed post.

parent post editing

Place the JetForm block in the post.

dding jetform to the post

Choose the needed Form to display in the Form Settings and push the “Update” button.

form settings

To reach the post on the front end, return to the post type and click on the “View” button of the parent post.

The form is now displayed in the post. Since we have added the Checkboxes field as the selector for the posts, you can select as many posts as you need. When you finish, press the “Submit” button.

NOTE

If some child posts are already related to the parent post, they will be ticked in the form placed on the parent post page. So, if you untick them, they will be disconnected from the parent post.

Return to the parent post editing page and scroll down to the Children tab. The options you have checked in the form will be added to the related posts list.

list of the children posts on the parent post

Now you can add the form to all desired parent posts.

Connect Child Objects to New Parent Post

Now let’s find out how to build a form that will make a new parent post and connect child objects to it.

Go to JetFormBuilder > Add New. Give the new form a title and delete the Hidden Field.

Click to edit the Text Field, it will be for the parent object name. Fill in the needed fields and remember to fill in the Name field appropriately, separate words with the “-” and “_” symbols, and use only lowercase Latin letters.

text field for the country name

The following field will serve as a selector for child items, so we add a Checkbox Field. During the field adjusting, focus on the Fill Options From and Post Type fields. Here you should select the correct source, the child post type.

checkbox for tour selecting

Moving to the Post-submit Actions tab, select the “Insert/Update Post” option and click on the pencil-shaped icon to edit the action.

insert update post submit action

In the appeared pop-up define the parent post type as the Post Type. Set the Post Status to “Published” and head to the Fields Map.

The displayed fields refer to those fields you have added to the form. The Text Field of yours should be connected to the “Post Title” and the following Checkbox Field left with the default option. 

Hit the “Update” button to save the result, and let’s add one more action by pressing the “+ New Action” button.

edit action

This time we select the “Connect Relation Items” post submit action.

connect relation items

Set the needed Relation, choose the “inserted-post-id” option as the Parent Item ID, choose the name of the Checkbox Field as the Child Item ID, and leave the Update Context field empty. In the How to Store the New Item field, you can select the most appropriate choice for you. When you finish, press the “Update” button.

edit connect relation items action

Feel free to add as many additional fields, as you need, for instance, the Media Field to add a picture to a new post. 

The final step here is to save the form, so push the “Publish” or “Update” button and head to the page where the form will be located.

Place a JetForm block on the editing page, and fill in the Choose Form field with the form’s name.

Set up the fields and form styles, and press the “Update/Publish” button to save the page.

 jetform on the single page in the Gutenberg editor

Check the front-end result. You can fill in the form with a title and relate some items to it. Finally, press the “Submit” button.

jetform on the front end

Head to the parent post type (“Country”, in our case) and search for the newly created post. Open it in the editor by pressing the “Edit” button next to the post title and check the attached children posts.

newly created parent post with related posts

Connect Parent Objects to Child Ones

Navigate to the WordPress Dashboard > JetFormBuilder > Add New. Give a title to the form. Leave the default Hidden Field block settings and create the field for the parent object items list.

For example, we have added the Radio Field block to have the ability to pick only one option in the form.

Select the “Posts” as the source in the Fill Options From field and define the needed Post Type. As we want to select the related parent for the relationship “Country > Tours,” we have chosen the “Country” Post Type.

In the Block General settings, type the Field Label and change the Form field name.

Press the “Dynamic tags” button in the Default Value field to open the pop-up.

radio field block

Preset in this form has the same settings and options as in the previous form, but in this case, you need to select the “Parent object” option in the From Object field and click on the “Update” button.

preset editing of the form

Move to the JetForm settings and the Post Submit Actions tab. Select the “Connect Relation Items” option and click on the pencil-shaped icon to edit the action.

In the new pop-up window, select the needed Relation. As the Parent Item ID, choose the label of the created field for the related items (the Radio Field in our case). Pick the name of the Hidden Field (with the default “Current Post ID” option) as the Child Item ID. Since it’s needed to display the parent object in the form, choose the “We updating parent items for the child object” option in the Update Context field.

edit connect relation items action

Push the “Update” button to save this action and click on the “+ New Action” button to create a new one.  Select the “Insert/Update Post” option and hit the pencil-shaped icon under this action.

Select only the Post Type of the parent items in the new pop-up and nothing more. Otherwise, the new related items replace the old ones instead of just being added to them.

edit insert update post action for parent object form
edit insert update post action for parent object form

Hit the “Update” button and publish or update the form to save the changes when you finish editing fields and actions.

To place the form on the child object, proceed to the child Post Type on the WordPress Dashboard, click to edit the needed post, and put the JetForm block in the post. Choose the needed Form to display in the Form Settings and push the “Update” button.

list of the parent posts on the child post

To reach the post on the front end, return to the post type and click on the “View” button of the child post.

The form is now displayed in the post. Select the needed parent object and press the “Submit” button.

form for the parent item on the front end

Connect Parent Objects to New Child Post

You can also build a form that will add a new child post and connect it to the parent at once.

Navigate to the WordPress Dashboard > JetFormBuilder > Add New.

Now you can delete all the Hidden and Text fields to avoid getting confused during editing.

We start with adding a Text Field for a new post name. Feel free to adjust this field as desired. Remember that the Name field shouldn’t include capital letters, spaces, and other special characters.

text field for children post name

The following field is for choosing a parent, so we select Radio Field to let users pick one option.

Select the “Posts” as the source in the Fill Options From field and define the needed Post Type. As we want to select the related parent for the relationship “Country > Tours,” we chose the “Country” Post Type.

In the Block General settings, type the Field Label and Form field name.

radio for parent post selection

Move to the JetForm settings and the Post Submit Actions tab. Select the “Insert/Update Post” option and click on the pencil-shaped icon to edit the action.

Pick the child post type in the Post Type menu and select the “Published” Post Status.

In the Fields Map, we define the ‘tour-name’ Text Field as a “Post Title” and leave the default “Select post property” in the ‘choose-country’ field.

Click on the “Update” button to save the result.

insert update children post submit action

Click on the “+ New Action” button to add a new one. Select the “Connect Relation Items” option and hit the pencil-shaped icon under this action.

Set the needed Relation, select the name of the Radio Field as the Parent Item ID, choose the “inserted-post-id” option as the Child Item ID, and leave the Update Context field empty. In the How to Store the New Item field, you can select the most appropriate choice for you. When you finish, press the “Update” button.

connect relation items action

Feel free to add as many additional fields, as you need, for instance, the Media Field to add a picture to a new post. 

The form is ready, so press the “Publish” or “Update” button. 

Go to the page you want to place the form. For instance, it can be a standard WordPress page.

Place the JetForm block onto the page editor, and pick a new form name in the Choose Form field.

Work on the other fields if you wish. Ultimately, press the “Update/Publish” button and go to the front end to check the final result.

jetform on the page in the Gutenberg editor

Now you can complete the form with the title and related parent. Click the “Submit” button to save the post and add a related item to it.

jetform for children posts creation on the front end

Let’s check if the new tour was added to the child post type. Head to the child post type and search for the new post. For instance, you can type in a post title in the search bar.

Once the post is opened, scroll down to the Related… tab. The parent post is now successfully connected.

newly created child post

That’s it. You know now how to connect the JetEngine relation items via the JetFormBuilder forms.

Referer URL is a JetFormBuilder feature that allows you to get a hidden field with the user’s address to the current page with the WordPress form, created via the Gutenberg block editor. This feature can help you to collect SEO statistics.

Proceed to JetFormBuilder > Forms and click on to “Edit” or “Add New” form, according to your needs.

Open the Field Value drop-down menu in the Hidden Field block and select the Referer URL option.

referer url option in the hidden field block in the form

Add the form to any post or page, if you haven’t done it yet, hit the “Publish” or “Update” button and proceed to the front end. You can do this by pushing the “View Post” or “View Page” buttons.

Submit the form and open the DevTools page. Here you can see the user’s referer URL.

referer url on the front end

That’s it. You know now how to get the user referer URL from the JetForm Hidden Field block.

Global Form Macros is a JetFormBuilder feature that allows you to use the value of some field in the layout of another block.

You can add the <!–JFB_FIELD::field_name–> macro inside the HTML tag or add it to one of these attributes:

  • href;
  • src;
  • alt;
  • title.

Contents:

How to Add the Form Macros to the Buttons Block

For instance, if you want to add the form macros to the Buttons block, it’s better to do it via the “Edit as HTML” button.

edit as HTML button

Paste the <!–JFB_FIELD::field_name–> macro into HTML before closing </a> tag. Change the field_name to the actual name of the field from where you want to get the value.

adding macros into the HTML code

For example, we have entered the name of the checkbox field “kind,” where the user can check the kind of trip.

Proceeding to the front end, we can see the button in the form with the “Read more about” text.

buttons block on the front end

If you check an option from the checkbox, it will be shown in the button. If you choose several options, they will be separated by commas. You can add the page link to the button with the information about all trips so that the users can find out about the needed trip.

buttons block with the macros on the front end

How to Add the Form Macros to the Label of the JetForm Fields

If you need to place form macros into the label or description of some JetForm fields, we do not recommend you add it via inline editing because the symbols will be transformed, and you’ll get the invalid macro on the front end.

jetform fields inline editing

So, it’s better to enter the form macro in the Field Label. Feel free to enter as many form macros with the field names as you need. You can also mix form macros with the plain text like that: price per night: <!–JFB_FIELD::price–> $. It will look on the front end like that: price per night: 170 $.

form macros in the field label

With these settings, users can see the values at the end of the form they have chosen. Such settings can also be applied to the multi-step form so that users can see all their choices at the last step before submitting the form.

form macros in the field label on the front end

Such a way also works with the Action Button block since it cannot be edited as HTML. We have added the macro of the Text Field in the Field Label of the Action Button.

submit button with a macro

When users enter the text into the Text Field, the same text is shown in the Action Button on the front end.

submit button with macros front end

That’s it. You know now how to add value from the JetForm field by using the global form macros.

Integromat is a free platform that allows you to connect apps (e.g., Gmail) and automate workflows using a no-code visual builder. Let’s find out how to connect a WordPress form to Integromat.

Set Up Integromat and Add Webhook

Sign in or sign up to the Integromat platform. After getting to the My Lab page, go to the Scenarios tab in the left-side menu and click on the “Create a new scenario” button in the upper right corner.

integromat create a new scenario

Hit the big plus button and choose the Webhooks module from the list of tools. A Webhook in web development is a method of augmenting or altering the behavior of a web page or web application with custom callbacks. More about the Custom Webhook you can find out in this Integromat tutorial.

webhooks on the new scenario integromat page

Then you’ll see the list of triggers and actions. You need to choose the Custom webhook option.

custom webhook

Click on the new Webhooks module. Hit the “Add” and “Save” buttons to enter the name for the Webhook.

webhook name addition

After that, you will see the generated link, which you should copy to the clipboard. Then proceed to your WordPress website without closing the Integromat window.

re-determine data structure

Set Up the JetFormBuilder Form

Navigate to WP Dashboard > JetFormBuilder > Forms, find the form you want to connect with Integromat, and change a default “Send Email” Post Type Action to “Call a Webhook.” Click on the “Edit” button and paste the URL address to the field. Update the Post Submit Actions and WordPress form by clicking on the similarly named buttons.

call webhook post submit action

Navigate to the front-end page with that form and submit it. After that, you should see the green note – “Successfully determinated” – in the Webhook. Hit the “OK” button.

Adding Another Module

With the Webhook in the Integromat, you could connect any app to the WordPress form. For example, let’s attach the Gmail app. Hit the “Add anoter module” button, add the Gmail module and then pick the Send an email action.

Click the “Add” button near the Connection bar and connect Integromat to your Gmail account. You also need to define the email address for the letters to be sent To, their Subject, Content, and Attachments. To fill the bars, you can use the data users will put into the form fields; just choose the ID of a particular field. Push the “OK” button.

Gmail connection

If you need to connect two or more modules to the Webhook, use the Router. Click on the wrench icon between the Webhook and Gmail modules and unlink the connection. In the Tools panel, click on the “Flow Control” button. Drag and drop the Router module and connect it with other modules. Now you can add more apps to the Scenario.

router module

To run the activated scenario, you could set up the schedule. Enable the Scheduling toggle at the bottom left corner and push the “Schedule setting” icon. You can read more about it in the Integromat article and choose the most appropriate option.

run the scenario

That’s it. With Integromat,  you can add as many apps as you want to the WordPress form.

MailChimp is a service that helps you manage email notifications and a list of user emails. With the MailChimp Post Submit Action, you can connect the JetFormBuilder form and the MailChimp service. The data that users insert into the form will be transferred to the application, and you will be able to use it there.

If you still don’t have a MailChimp account, please, feel free to check this tutorial. It provides detailed instructions on creating an account and finding out your MailChimp API key and Audience ID.

To create a MailChimp Subscribe Form in WordPress, head to JetFormBuilder > Add New. Give a name to the form and delete the default post_id field since we don’t need it.

add a new form

Add new fields manually or use the Subscribe Form Pattern. It is the list of fields that you can create and later connect to the MailChimp:

  • Text Fields:
    • for Email is required;
    • for first\last name, address, phone can be added if you wish;
  • Date Field for date of birth.
create new fields

Then open the JetForm tab and proceed to the Post Submit Actions section. Set the type to MailChimp and click on the “Edit Action” icon.

post submit action mailchimp

In the newly appeared window, you should input your MailChimp API Key.

edit action window

You can paste it manually or enable the Use Global Settings toggle. If you pasted the MailChimp API Key in the JetFormBuilder Settings, it appears automatically. Then hit the “Validate API Key” button.

jetform builder settings

If the operation is successful, you will see the new “Audience” field. Select the Audience name that you have input on the MailChimp website. If you have added another Audience and don’t see it in the list, click on the “Update Audience List” button.

After you set the Audience, more fields will appear:

  • Groups. If you have created them in the Manage contacts tab on the MailChimp website, your groups should appear in this field;
  • Tags. You can input here tags, which you have created on the MailChimp website;
  • Double Opt-in. Enable this toggle in case you want the contacts to receive an opt-in confirmation email when they subscribe to your list;
  • Fields Map. There is a list of fields where users can enter their data, which can be attached to the MailChimp website. In that drop-down, you can choose appropriate fields from the form. The Email field is required.
validate api key

After customizing all settings, “Update” the Edit Action and “Publish” or “Update” the form.

The next step is adding the form to a page. To obtain the information on how to do this, follow this link.

When users subscribe with your form, you can see all information about them on the All contacts tab.

subsribed audience

That’s it. Now the users’ data will be transferred to the MailChimp website.