Bryce Lohr schrieb:
Hi *,

I've been using an old version of the Validate plugin (1.1.2) along
with the Masked Input plugin. Today, I just upgraded to Validate 1.2.1
and noticed it doesn't behave quite the same with the masked inputs.

For example, I have two date fields, the first is required and the
second is optional. Both are masked ("99/99/9999", if it helps). If I
tab through or click on the optional date field, I get a validation
error ("Please enter a valid date"; the default message) on the
optional field. I can still successfully submit the form, however.

In version 1.1.2, this did not occur. I could tab or click through the
optional date field without seeing an error. If I remove the input
mask, it also works as expected. It appears that the empty mask ("__/
__/____") is being passed to the date validation method, which, of
course, fails. Also, I understand from the changelog that there were
some non-trivial changes to how events are handled in the Validate
plugin, starting at 1.2.0. Are these changes perhaps conflicting with
the masked input plugin?

Here is a minimal example form:
http://www.gearheadsoftware.com/validate-masked.html

View source to see the code. Changing this form to use Validate 1.1.2,
with no other changes, gives the behavior I'm after.
Since 1.2, the validation plugin uses event delegation for handling those events. This effects the order in which events are handled, which causes the issue.

The masked-input plugin is part of the marketo demo: http://jquery.bassistance.de/validate/demo/marketo/ Worth noting is that the masked input is setup after the validation. In addition, handling keyup events is disabled: http://jquery.bassistance.de/validate/demo/marketo/mktSignup.js

So for a start, try to reverse the initialization order.

Jörn

Reply via email to