Skip to main content
March 27, 2015
Question

Restricting numbers and symbols from Name text fields

  • March 27, 2015
  • 3 replies
  • 1056 views
I'd like to block any numbers or symbols from the first and last name text fields on our forms, as well as certain text, such as using "first" or "last" as a name -- has anyone successfully implemented these restrictions?

Thanks!
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

March 30, 2015
Hi Joe

My solution is Using forms2.0 embed code and customize these codes.
http://developers.marketo.com/documentation/websites/forms-2-0#examples
 
SanfordWhiteman
Level 10
March 30, 2015
What @Takehiro said, like in onValidate:

if ( /(\d|^First$)/i.test(vals().Firstname ) ) {
    // kick them back out with an error
}

However I'd be wary of trying to account for too many "fake" names.  Eventually you run up against a false positive, especially in your own debugging (I frequently use "Sanford Whiteman2," "Sanford Whiteman3" for test accounts).  Also, "Last" is a totally legitimate last name
March 30, 2015
Thank you both, I really appreciate the help.

And "Last" is a last name - who knew!