Hi, thanks for your help in advance!
I am trying to set a form that will prepopulate the country dialling code before the 'Telephone' field based on the country selected previously.
I would really appreciate your advice on how to set this. Is there any solution within Marketo (not involving 3rd parties) and if not, do you have any recommendations?
Thanks again!
Solved! Go to Solution.
You do it like this:
MktoForms2 :: Country Code Dependency
Notice how once the person changes Country Code directly, it gets decoupled from the Country field from then on.
And all the values in the countryCodeMap
obviously have to be options in the Country Code dropdown in order for them to be automatically set.
Hmm, this looks like a feature that Marketo forms should have, but I don't think they do. Form Visibility Rules get you somewhere though:
That would make it so that after the selection in "Country", your user would only see the correct option for the field "Phone Country Code" (I don't have that field in my database so I lazily just took "Phone Number").
But I'm certain that you can do it with Javascript. ChatGPT and Co. should be able to help you write it.
But I'm certain that you can do it with Javascript. ChatGPT and Co. should be able to help you write it.
Highly doubtful that anything generated that way will properly use the Marketo JS API. Half the hand-written code out there doesn’t use it correctly.
First, expecting the person’s mailing or billing country and their phone country code to match is a fundamental fallacy of data management. It’s usually the case but by no means always. So you must let the person select the country code they want even if you give them a “hint” based on their Country value.
Next, are you talking about storing the phone country code in a separate field, as Michael was assuming? Or do you mean to inject the starting characters in the standard Phone field?
Hi,
My Idea was to have a drop down just after the country field with the dialling code, that would auto populate once the country is selected, but still gives the chance to change it. As you said, it is usually the case, but may not be the code they want.
Yes, my intention is to store the phone country code in a separate field.
Thanks all for your help
You do it like this:
MktoForms2 :: Country Code Dependency
Notice how once the person changes Country Code directly, it gets decoupled from the Country field from then on.
And all the values in the countryCodeMap
obviously have to be options in the Country Code dropdown in order for them to be automatically set.