Froms 2.0 - Persisting a validation error message upon form submit via ENTER key

Anonymous
Not applicable

Froms 2.0 - Persisting a validation error message upon form submit via ENTER key

Hi, 

We're using an embedded Marketo form on our website, and we use the Forms 2.0 API to validate email domain (we want to restrict users from signing up with personal email domains like Yahoo.com, Gmail.com, etc).  

Thanks to both discussions forums and API documentation, our code mostly works.  We are using the showErrorMessage() method.

What we've noticed is that when the user clicks the submit button, the error message is shown until the user then edits the field.

However, if the user hits the ENTER key to submit the form, then the error message is shown briefly, and then disappears.  It looks as if the form resets if the user clicks ENTER.

Anyone have any idea how to get the behavior the same between using the ENTER key and the SUBMIT button?

For what it is worth,  it looks like another user who posted a live web page where he is doing the same thing, also has the same issue (see @Egnet Dang's response from July 24 here: https://community.marketo.com/MarketoDiscussionDetail?id=90650000000PlhSAAS).

Any ideas?
Tags (1)
2 REPLIES 2
Kenny_Elkington
Marketo Employee

Re: Froms 2.0 - Persisting a validation error message upon form submit via ENTER key

Hi Erik,

Are you setting the .submittable property of your form to false when validating these?  This could be the issue you're encountering.
Anonymous
Not applicable

Re: Froms 2.0 - Persisting a validation error message upon form submit via ENTER key

@Kenny - thanks for the suggestion.  However, we are indeed setting the form to not be submittable.

form.submitable(false);
var error_msg = "Please prvoide  a non-personal, corporate email address."
form.showErrorMessage(error_msg, emailElem);