Skip Navigation

[Resolved] Need to understand Relationship Forms and how to use with Post forms

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

Author
Posts
#2635261

I have a front-end post form that users fill out, the only field missing is the ability to select an organization to associate with the rest of the form data that creates a post in Opportunities. I want the user to be able to select an existing Organization from the Organization post type list when submitting the rest of the form data.

I'm trying to follow https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/#:~:text=Go%20to%20Toolset%20→%20Relationship,form%20fields%20or%20rearrange%20them. but I am not understanding. I don't want the user to have to fill out to separate forms? Why can't the relationship just be entered on the other post form from a drop down or something?

#2635605

Nigel
Supporter

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

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

Hi Larry

Regular forms publish or edit posts, while relationship forms are used to connect existing posts.

Unfortunately you cannot combine the functions in a single form, except where the regular form is to publish a child post, in which case the form can include a selector for the parent post the child post should be attached to. (This can also apply to a one-to-one relationship, the key being that the relationship selector will be for the "one" part of a one-to-something relationship, which equates to the parent in a parent-child relationship.)

It could be possible to combine the functionality into a single form, but that would require custom coding using the Forms and Relationships APIs. You would need a custom select field in the form that the post to connect to could be chosen from, and then code that runs when the form is submitted to actually make the connection.

If you are not a programmer, you could try contracting someone to do that part of the development for you: https://toolset.com/contractors/

#2636105

Could I implement a post reference field instead? https://toolset.com/forums/topic/use-wpv-post-field-in-cred-form/

I added this to my Post Form I was wanting this on, but nothing displays to allow the front-end user to select an Organization from the drop down like it does on the back-end.

[wpv-post-link item="@opportunity-sponsor-link.parent"]

#2636455

Thanks for writing back.

The other support thread that you mentioned is very old and won't be very useful for what we're discussing in this ticket.

I had access details for your website from the previous recent ticket. The 'Organizations Opportunities' is set as a 'many-to-many' relationship.

Do you really need to connect more than one 'Organization' to a single 'Opportunity'? I'm confirming this because, in your opening message, you mentioned the 'ability to select an organization' and not 'multiple organizations'.

If you need to connect just one 'Organization', you can change that relationship type to 'one-to-many' ( Organizations -> Opportunities ) and it will solve the challenge that you're having. You'll have the option to select an 'Organization', in the forms to add/edit 'Opportunity' posts.

#2636615
Screenshot 2023-08-23 at 6.55.39 AM.jpg

Thank you for clarifying. It should have been a one (Organization) to many (Opportunities) relationship. I just edited realtioships and corrected that. Thank you.

I 'm not sure which of these is the field I should be adding to my Opportunity form?

#2637023

When you'll click the 'Add fields' button, you'll see an 'Organizations Opportunities' field under 'Relationships'.
( screenshot: hidden link )

Please make sure to use the 'Add fields' button for field selection and not the one for 'Fields and Views'.
( screenshot: hidden link )

#2637213

Thank you!!!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.