jpillora / verifyjs

Verify.js - A powerful, customizable asynchronous validation library
http://verifyjs.jpillora.com/
161 stars 61 forks source link

How can I add rules on-the-fly to a form field? #16

Open carlosfrias64 opened 9 years ago

carlosfrias64 commented 9 years ago

Hi, I've been using this plugin for validation and it's awesome!

The thing I'm trying to do is to add another rule on-the-fly to a form field that already has the data-validate="" attribute.

I tried modifying the $('input').data('validate') property, or even the attribute data-validate, but cannot get VerifyJS to apply the new rule(s) added.

Anyway, great work and congratulations!

jpillora commented 9 years ago
$('input').attr('data-validate', 'myNewRule');

And it should now use myNewRule, it if doesn't, it's a bug