I am trying to dynamically control a field’s visibility on a global form using a hidden field that would reference the hosted page URL. Would I be able to use the visibility rules feature. Configuring a hidden field to pull and the URL of the current page?
Solved! Go to Solution.
The Visibility Rules part will work fine. But you’ll have to set the Hidden field via JS as there’s no builtin way to fill from the entire current URL. Assuming your field is called Last Marketo Form URL:
MktoForms2.whenReady(function(mktoForm){
mktoForm.setValues({
LastMarketoFormURL : document.location.href
});
});
The Visibility Rules part will work fine. But you’ll have to set the Hidden field via JS as there’s no builtin way to fill from the entire current URL. Assuming your field is called Last Marketo Form URL:
MktoForms2.whenReady(function(mktoForm){
mktoForm.setValues({
LastMarketoFormURL : document.location.href
});
});
@SanfordWhiteman - Thank you for the reply and proposed solution. Just to be clear this snippet of JS should be on the landing page the form is on, correct?
. Just to be clear this snippet of JS should be on the landing page the form is on, correct?
Yes, if it’s a Marketo LP, put the code just before the closing <body> tag.