1

I want to add a custom function using jquery validation framework, to help validating names (first name and last name) inside a form.

I understand I could just eliminate numbers... but wondering if there is a 'best practice' way using jquery validation framework, somebody could suggest me...?

Thanks

4
  • as per requirements... only letters, apostrophes and hyphens are allowed for the name fields Commented Apr 27, 2010 at 13:30
  • What about whitespace? Accents éêèà etc...? What about periods for "Don Jr."? Commented May 4, 2010 at 14:27
  • @Alex: not accepting Accents and the name fields are broken like ... first name is separate than last name (so no whitespaces) and there is no suffix. So ^[a-zA-Z'-]+$ worked fine. Commented May 7, 2010 at 17:24
  • Name validation is a bad idea. See kalzumeus.com/2010/06/17/… Commented Jul 27, 2012 at 19:23

1 Answer 1

1

I used regular expression to validate the name fields on the form : ^[a-zA-Z'-]+$ using the jquery.validator.addMethod

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.