Skip Navigation

[Resolved] URL parameter for a relationship field on a CRED form

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

Problem:
How can we populate the Parent Post Selector on a Toolset Form using the value passed in an URL parameter?

Solution:
You can specify the URL param to listen to in the Forms Parent post selectors like so:

[cred_field field='@relationship.slug.parent' class='form-control' output='bootstrap' select_text='Custom Select Text' urlparam='custom_url_parameter']

Then link to the page where the form is inserted to by passing the custom_url_parameter
in the URL, populated with the ID of the parent post.

This support ticket is created 4 years, 11 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by geophray 4 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#1489117

Tell us what you are trying to do?
I'm trying to pre-populate a relationship field on a cred form using URL parameters, but I'm not having any luck getting it to pre-load one of the existing/published CPT posts using a URL parameter.

Here is the code as it was output from the CRED field generator:

[cred_field field='@staff-member-review.parent' class='form-control' output='bootstrap' select_text='Rate a specific Staff Member' urlparam='staffmember']

I've tried accessing the form using hidden link as "jeff-maughan" is the slug of one of the CPT posts I'm testing with, but it's not working. I've also tried "jeff%20maughan".

Is there any documentation that you are following?
I have not been able to find any documentation on this, but that could be due to not knowing the correct search terms to use. I'll continue to try and will update here if I find anything that helps.

Is there a similar example that we can see?
I'm including a link below.

What is the link to your site?
The link to my cred form is hidden link
The site is in development and has privacy mode enabled, so you will need the following access info to view it:
u/n rodlimb
p/w communicating-love

#1489199

You should use the Post ID, instead of the Slug or Title, that'll do, as the slug or title is not accepted, but ID is.

#1489361

Thank you Beda! Works like a charm using the post ID! Should have thought to try that...