adding compatibility with masked-input plugin
Client side validations is a great gem.
When using this with the masked-input-plugin (http://digitalbush.com/projects/masked-input-plugin), it looks like fields with masked input do not call the validation on blur.
Any idea what/how to hook to do the validation? line 243 of the jquery.maskedinput-1.3.js file reads as follows:
.bind("blur.mask", function() {
checkVal();
if (input.val() != focusText) {
input.change();
}
//CAN WE HOOK HERE, tried the following but didn't work
//input.change().focusout();
})
that code is getting called when tabbing out of the field
I really don't know, I'm not familiar with this library.
Do you know in general what the strategy is to re-hook client side validations if another library is binding to the onblur? Do you think the approach above is on the right track?
Thanks
Something that worked for me was to rebind the focusout of client_side_validations after binding the masked-input. Something like (coffeScript):
settings = window[$('form').attr('id')] $('.phone').mask('(99) 9999-9999').focusout( -> $(this).isValid(settings.validators))
Thanks Rafael!
Sent from my iPhone
On Nov 4, 2011, at 7:15 PM, Rafael [email protected] wrote:
Something that worked for me was to rebind the focusout of client_side_validations after binding the masked-input. Something like (coffeScript):
settings = window[$('form').attr('id')] $('.phone').mask('(99) 9999-9999').focusout( -> $(this).isValid(settings.validators))
Reply to this email directly or view it on GitHub: https://github.com/bcardarella/client_side_validations/issues/194#issuecomment-2638508