Re: Restricting numbers and symbols from Name text fields

Anonymous
Not applicable

Restricting numbers and symbols from Name text fields

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!
Tags (1)
3 REPLIES 3
Anonymous
Not applicable

Re: Restricting numbers and symbols from Name text fields

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 - Community Moderator

Re: Restricting numbers and symbols from Name text fields

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
Anonymous
Not applicable

Re: Restricting numbers and symbols from Name text fields

Thank you both, I really appreciate the help.

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