Tuesday, December 1, 2009

Re: [jQuery] validate

you can create your own method using the addMethod (http://docs.jquery.com/Plugins/Validation/Validator/addMethod)

On Tue, Dec 1, 2009 at 11:50, tom <thomasfotherby@googlemail.com> wrote:
I'm using the jquery.validation plugin by Jörn Zaefferer and I was
wondering whether there's a easy way to trim form elements before they
are validated.

For example, if I'm validating a email address: "test@test.com   "
using the "email : true" rule, it'll display an error because the
trailing whitespace is invalidating the email format. I was hoping I
could chain "jQuery.trim(value)" before the validation so the
whitespace is removed and the validation error never occurs?

Disclaimer: The jquery.validation plugin documentation page currently
isn't working (http://docs.jquery.com/Plugins/Validation) so I can't
RTFM.

No comments: