Froms 2.0 - Persisting a validation error message upon form submit via ENTER key | Community
Skip to main content
July 31, 2014
Question

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

  • July 31, 2014
  • 2 replies
  • 946 views
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?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Kenny_Elkington
Adobe Employee
Adobe Employee
July 31, 2014
Hi Erik,

Are you setting the .submittable property of your form to false when validating these?  This could be the issue you're encountering.
August 1, 2014
@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);