URL Parameters Working in Conjunction with Dynamic State | Community
Skip to main content
November 8, 2013
Solved

URL Parameters Working in Conjunction with Dynamic State

  • November 8, 2013
  • 2 replies
  • 1035 views
I am trying to have a URL Parameter fill in the country of a form, but I want the field to show in case they need to change it. Also, if the country is filled in with US, CA, or AU, I want the dynamic state functionality to work.

Has anyone tried this? I imagine custom code will be required, but I thought I would ask the Community first.

Thanks!
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by
From what I understand, you would need custom javascript code to get this functionality. 
Also, you may want to present the Country field as a single select field with list of countries. And when the country value is changed, you want to show another single select field with states for that country.

In your javascript code, 
1> Check if country is already populated by Marketo. If yes, do not override (depends on your requirement)
2> Otherwise, read the query parameter and populate the country. And also show the rest of the country value options.
3> Separately, you can have 3 javascript arrays each for states of US, CA and AU. On change of the country value, if it is among these 3 countries, show the state field and populate the choices for the respective array.

Let me see if I can find the javascript code...

Rajesh

2 replies

Accepted solution
November 11, 2013
From what I understand, you would need custom javascript code to get this functionality. 
Also, you may want to present the Country field as a single select field with list of countries. And when the country value is changed, you want to show another single select field with states for that country.

In your javascript code, 
1> Check if country is already populated by Marketo. If yes, do not override (depends on your requirement)
2> Otherwise, read the query parameter and populate the country. And also show the rest of the country value options.
3> Separately, you can have 3 javascript arrays each for states of US, CA and AU. On change of the country value, if it is among these 3 countries, show the state field and populate the choices for the respective array.

Let me see if I can find the javascript code...

Rajesh

November 12, 2013
Thanks Rajesh!