Okay last question - I know I can validate forms on submission but is there a way to do it in reverse?
Example case:
Page 1 = Initial landing page with form to enter their Marketo unique code
Page 2 = follow up page with Marketo form that will be "prefilled" after the Marketo pURL enabled page passes the data to it
User on page 1 enters invalid code (whether a typo or just trying to mess around), user should be shown an invalid code message.
I'd just check if the field is empty but there is a button on page 1 that allows the user to proceed if they don't have a code (i.e. end up on the page by accident or don't have their code in front of them and just want to submit info). So I'd have to validate the entered code on submission or on the Marketo pURL page and pass back some type of hiddenfield value so I could check that to display an invalid code message.
If someone ends up on a pURL-enabled page but they enter an invalid pURL, then they'll get the default field values (which will be empty)... not sure why checking that doesn't suffice? I would assume the "Forgot your code?" link would go straight to the non-pURL, non-Marketo page.
It seems to be working now....there were no code changes made per se. I just restarted with a new blank template - so not sure what was causing that but as of now it's back working the way it should. Thanks!
Best way I've found to pre-fill embedded forms on external pages is to iFrame in a Marketo page with the form, or take them to a Marketo page with the form which then forwards them to your external page.
You can also look at passing the email address in a parameter which is then picked up by a hidden field. Some people are against this for security reasons but if you're passing a lead ID you've already created a big enough security hazard and email is probably a little less dangerous.
Someone fancy with JS and JQ wrote that. Sanford Whiteman can verify whether that'll work or not, but the traditional way that's in the online examples is to do it this way:
MktoForms2.loadForm("//app-XXXX.marketo.com", "123-XXX_456", {{my.Form ID}},
function(form) {
form.vals({"Phone":"{{lead.Phone Number}}",
"FirstName":"{{lead.First Name}}",
"LastName":"{{lead.Last Name}}",
"Company":"{{company.Company Name}}",
"Email":"{{lead.Email Address}}"
});
That won't work on an external page. What Nick's doing is gathering the fields from tokens (not prefilled fields per se, but effectively the same) and encoding them to be passed to an external destination.
I thought that too but I'm moving past that point since he's showing code above that's having a discrepancy. It seems like it's able to pick up the name attributes so my assumption is we're no longer external.
The page that reads the tokens is a Marketo pURL-enabled LP.
The page with the form is a non-Marketo page.