Skip Navigation

[Resolved] How to automatically select both sides of a many to many relationship in a form

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

Problem:
How to automatically select both sides of a many to many relationship in a form

Solution:
There is no such feature exists to set both parent and child using post relationship form.

https://toolset.com/forums/topic/how-to-automatically-select-both-sides-of-a-many-to-many-relationship-in-a-form/#post-954437

Relevant Documentation:

This support ticket is created 6 years, 4 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 17 replies, has 4 voices.

Last updated by Ahmed 6 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#954500

Minesh
Supporter

Languages: English (English )

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

Please feel free to close the ticket as we already noted down your ticket. Please keep your eye on our blog page for latest updates:
=> https://toolset.com/blog/

#954681

Ok I will.

#1115863

I found a solution and I am posting it here for those who might face the same issue:

https://toolset.com/forums/topic/set-intermediary-relationships-in-cred-new-post-form/

of course the title of that post does not reflect the content and I actually found it accidentally when I was looking into a different issue.

Basically the code to do this is:

[cred-relationship-form form='form-name' parent_item='$doctor_id' child_item='$patient_id']

you replace the form_name with your form name and replace $doctor_id with your parent post id and $patient_id with the child id, and you can populate those automatically through views (has to be stripped out of additional markup to work) which fetches those numbers for you.

I am astonished to why I was not directed to that simple solution by any of the supporters! That'd have saved me 2-3 months of my life and a missed deadline!!