jpkleemans / angular-validate

Painless form validation for AngularJS. Powered by the jQuery Validation Plugin.
MIT License
68 stars 32 forks source link

Impossible to validate dynamic inputs #22

Closed Kaijiro closed 6 years ago

Kaijiro commented 6 years ago

Hey,

I'm using a form with an iterable field. It looks like a text with a '+' at its side and when I click on it, I create a new input, and so on.

It seems that newly created inputs are not affected by the validations rules ? (I update the validation rules each time I create an input)

Any clue for this problem ? Thank you for your help

jpkleemans commented 6 years ago

That's something that isn't supported by the jQuery Validation Plugin. You can read more here: https://github.com/jquery-validation/jquery-validation/issues/1226

Kaijiro commented 6 years ago

In fact, I managed to find a way to make it work :

Each time you submit the form, you can call form.validate($scope.validationRules). It will use the newly updated rules so you CAN use it with dynamic inputs.

jpkleemans commented 6 years ago

That's great!