[Résolu] Need to understand Relationship Forms and how to use with Post forms
This support ticket is created Il y a 1 année et 3 mois. 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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
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.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00: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/
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.
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.
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?