Skip Navigation

[Resolved] Default value of field in many-to-many relationship form

This support ticket is created 2 years, 2 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
- 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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#2458391
screenshot-valdanos.idl.pl-2022.09.15-15_27_56.png

Is it possible to to set default value (and value from an URL parameter) of field in many-to-many relationship form (like in one-to-many form)?

#2458877

Hello,

Yes, it is possible with relationship form shortcode [cred-relationship-form], for example:
1) You can get the URL parameter with shortcode [wpv-search-term]
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

2) Then pass it into relationship form shortcode as attribute values, like this:

[cred-relationship-form form='default-value-of-field-in-many-to-many-relationship-form' parent_item='[wpv-search-term param="my-parent-page"]' child_item='[wpv-search-term param="my-child-post"]']

In above example uses:
- URL parameter "my-parent-page" as parent post ID value
- URL parameter "my-child-post" as child post ID value

So you can pass the URL parameters like this:
hidden link