1

I'm trying to validate an input field which is 'disabled' when the page loads, but it will, somehow, become visible and editable.

I excluded [disabled] from parsley, but when I'm trying to refresh constraints on that field, nothing is working. I tried to call addValidation() when the field appears but no success.

Is there any method to do this? I can't destroy the form (that's not working either).

Matei
  • 372
  • 1
  • 8
  • 21

1 Answers1

1

Found out how to do this.

Just call _refreshFields() on your form.

$('form').parsley()._refreshFields()
Matei
  • 372
  • 1
  • 8
  • 21
  • This works, but while looking for another solution (the underscore indicates that this method is private and should only be used inside the library), I found [this issue](https://github.com/guillaumepotier/Parsley.js/issues/1058) in which they recommend using `$('form').parsley().isValid()` to achieve the same results using a public API. – Gui Meira May 02 '17 at 15:49