Skip Navigation

[Resolved] Use a field from a relationship in a post form

This support ticket is created 3 years 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 8 replies, has 2 voices.

Last updated by davidS-72 3 years ago.

Assisted by: Shane.

Author
Posts
#2260089
Captura de pantalla 2022-01-06 135050.jpg

I've been reading documentation and I supose the response, but I'm not sure and this is important for my project.

The question is: I want to create a form, like a post form, for a post type which has a field from a relationship.

I attach an image from a backend new "Publicació" and I want the same but for the frontend. I marked the field from relationship.

thanks
David

#2260193

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Thank you for getting in touch.

From your post I gather that you want to have the relationship field on your frontend form when you're creating your post correct? Is this a Many to Many relationship or a One to Many.

For Many to Many relationships you will need to use a Relationship form in order to create the relationship on the frontend.
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/

If this is a One to Many relationship then you should be able to add the relationship field on your post form or if your form is auto generated then the field should get added automatically.

Please let me know if this helps.
Thanks,
Shane

#2260957

Hi Shane,
is a many to many relationship.

I tried the Relationship forms, but are not to introduce all the fields. All I can obtain in a Relationship form is how to connect two existing post. Is this right?

I want a form where the user can introduce all the data, related fields included.

thanks,
David

#2260965

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Given that it is a many to many relationship then a relationship form is needed to connect the posts together on the frontend.

You won't be able to add any of your post fields to this form, only the custom fields in the relationship can be added.

What I mean by this is that you won't be able to create the post and connect them in a relationship at the same time.

You're going to have to do it using the method below.
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/

Please let me know if further clarification is needed.

Thanks,
Shane

#2260971

then the solution is:
1) first create a post form to create a new CPT1 "publicació" and then
2) in a second step with relationship forms connect CPT1 "publicació" with an existing post of CPT2 "Collection"

Is this right?

thanks,
David

#2260993

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

That is correct. If you add the relationship form to the template of CPT1 then you can have the publicació preselected and you will only need to select a Collect to connect to the post.

Thanks,
Shane

#2261245

Sorry, I'm not sure to understand this " If you add the relationship form to the template of CPT1 then you can have the publicació preselected and you will only need to select a Collect to connect to the post."

My doubt: If the post form is for a new post "publicació", how can I add or connect this new post with a Collection? how can I have a publicació preselected?

thanks
David

#2261249

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Sorry, I'm not sure to understand this " If you add the relationship form to the template of CPT1 then you can have the publicació preselected and you will only need to select a Collect to connect to the post."

What i'm referring to can be found at this exact link below. Its regarding adding your relationship form to your page template.
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/#using-the-post-relationship-form

If the post form is for a new post "publicació", how can I add or connect this new post with a Collection? how can I have a publicació preselected?

You be adding it to a new post form. The idea is that you would've already created CPT 1 and CPT 2. This relationship form assumes that both posts have already been created.

Essentially if you add the Relationship form to the template that is displaying the posts for CPT 1 then you can go to each individual post and then connect them to their corresponding CPT 2 post.

Thanks,
Shane

#2261277

My issue is resolved now. Thank you!