Skip Navigation

[Resolved] Querystring to load value in select

This support ticket is created 4 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Shane 4 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1505021

How can i select one of the value to be default by sending a Querystring ?
like /?p=2 then package two is selected when the form is loaded ?

I have a button on one page and this is like "Book this package" and the url to this is /trips/
and i thinking i could maybe add /trips?p=2 and in the form i use som wpf-condition , but i cant figure out how

[cred_generic_field type='select' field='packages']
{
"required":1,
"default":[],
"options":[{"value":"Package ONE","label":"Package ONE"},{"value":"Package TWO","label":"Package TWO"},{"value":"Package THREE","label":"Package THREE"},{"value":"Package FOUR","label":"Package FOUR"}]
}
[/cred_generic_field]

#1505431

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Patrik,

Thank you for getting in touch.

Unfortunately you won't be able to set the option using a query string using the url parameter without using some custom JS.

Take a look at the link below.
https://stackoverflow.com/questions/23591754/dropdown-selected-based-on-url-parameter-php-or-jquery

This should be able to get this working for you.

Thanks,
Shane