Skip Navigation

[Resolved] Create new posts in different post types which are connected with front end form

This thread is resolved. Here is a description of the problem and solution.

Problem:
Create new posts in different post types which are connected with front end form

Solution:
If you have post type A and post type B and you want to submit the post for both post type A and post type B from frontend, you will require one form for post type A to submit entries related to post type A and another form to submit entries for post type B. That means you will require two forms.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/create-new-posts-in-different-post-types-which-are-connected-with-front-end-form/#post-2296729

Relevant Documentation:
- https://toolset.com/course-lesson/front-end-forms-for-adding-content/

This support ticket is created 2 years, 10 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 3 voices.

Last updated by sofiaM 2 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#2296569
newVillage_administrator.png
newVillage_form.png

Greetings,

I have several different post types (Villages, Institutions, Institution Members and Solutions). Currenly if i add a new Village through administrator I am able to add an Institution, Institution Members and Solution through a list of already existing ones or add a new one. I want to create a form in the frontend for adding Villages but in the form in doesn't have the option to add for example a new Institution, I can only choose one of the already existing. Is there a way to enable the user to add a new post type from the Villages post form or do i need to have multiple forms for each post type? If that's the case what are the steps i should take to make that happen?
Thanks, in advance

#2296729

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Front-end forms can only create (or edit) a single post.

You cannot publish one post and within the same form also publish another post.

You need different forms to publish each post type.

When you have related posts, if they are parent-child (or one-to-many) relationships, then the form to publish a child post can connect it to an existing parent post (I think this is what you refer to).

You cannot connect child posts from a form to publish parents, nor can you connect a post that is part of a many-to-many relationship. For that you need to use the special relationship forms.

Assuming your posts are connected via one-to-many relationships then the best workflow probably includes creating parent posts first, and then using a link in the template for the parent posts to go to a form to add a child post to this parent (i.e. the parent is preselected, and can the selector can be hidden from the form).

See https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/#creating-forms-when-a-parent-post-is-preselected for a description of the steps involved.

#2298561

Thank you Nigel for your swift response, I believe I understood the solution you are proposing but I have another question. If I understood correctly it is also not possilbe to create multiple posts (of the same kind) in one form either? For example if I want to add multiple Solutions post type to a village through a form they have to be submited through different posts or is there a way to do it from one?

#2298661

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

With Toolset, for instance, if you have post type A and post type B and you want to submit the post for both post type A and post type B from frontend, you will require one form for post type A to submit entries related to post type A and another form to submit entries for post type B. That means you will require two forms.

#2298663

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

A single form can do just one thing: publish a post, edit a post, register a user, edit a user, or—with a relationship form—make a connection between posts.

If solutions are a child post of village then you need a separate form submission for each solution you want to add. If you include a link to add a solution to the template for villages, the workflow might look like clicking that link when viewing a village, completing the form to submit a solution, returning to the village post, and repeating as many times as needed, for each solution you want to add.

#2299051

My issue is resolved now. Thank you!