1

When only spaces are entered in required field, the validation is bypassed, it assumes that data has been entered in the field, wherein reality it is blank.

Any suggestions/solutions to this??

Thanks in advance.

Sonia G
  • 11
  • 1
  • Which validation plugin are you using exactly? – jerluc Jul 05 '11 at 09:59
  • Possible duplicate of [jquery form validate not allow space for username field?](http://stackoverflow.com/questions/2942325/jquery-form-validate-not-allow-space-for-username-field) – Balanivash Jul 05 '11 at 10:00
  • i am using jquery validation engine http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ – Sonia G Jul 08 '11 at 05:42

1 Answers1

0

jQuery has a nice function for trimming leading and trailing whitespace (API - jQuery Trim)

jQuery.trim(stringToTrim);

Will return the string without the whitespace.

Note that you can accomplish this also with regular expressions.

Alessandro Vendruscolo
  • 14,493
  • 4
  • 32
  • 41