Skip Navigation

[Resolved] Prepopulate CRED form taxonomy field with urlparameter

This support ticket is created 5 years, 9 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/Karachi (GMT+05:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by romanB-3 5 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#1229793

Hello,

I have this link

<a href="<em><u>hidden link</u></em>">link</a>

where 1863 is the term ID I want to be checked on a page displaying a cred form.

The cred form displays the taxonomy based on

 [cred_field field='nature' force_type='taxonomy' output='bootstrap' display='select' single_select='true' urlparam='nat']

But the select doesn't display the right term, as if it did not recognize the urlparameter.

Thank you.

#1229799

Hi Roman,

Thank you for waiting.

During testing, I was able to confirm that the pre-population of the taxonomy field from a URL parameter is not supported.

For this, you'll need to add some custom script, in the form's "JS editor" tab:
( screenshot: hidden link )


jQuery(document).ready(function() {
  // Construct URL object using current browser URL
  var url = new URL(document.location);

  // Get query parameters object
  var params = url.searchParams;

  // Get value of "nat"
  var nat = params.get("nat");

  // Set it as the dropdown value
  jQuery('select[name="nature[]"]').val(nat);
});

I hope this helps.

regards,
Waqar

#1229805

Thank you, this solved the problem.