guillaumepotier/Parsley.js — pull request #77 by catearcher (2013-01-28 15:27:01+00:00)
Title: needsValidation should return true if it was previously reset

It's up to you if you want to include this one or not, but I had to change it for the following use case:

I want to display a summary of all the errors in the form in an overlay. Imagine a user doing the following:
1. User fills in a form, makes three mistakes doing so.
2. User submits the form. Popup shows the three errors.
3. User corrects two of the errors, forgets about the third one. Popup should display the remaining error, but does not display anything, because the field with the error was not changed so needsValidation returned false.

So far needsValidation has not done anything wrong, because false is the correct return value if nothing was changed. **But**:

I then tried fixing it by calling .parsley("reset") in my code, but this only removes the classes from the field and sets isValid to null.

The issue can be fixed by simply checking (inside needsValidation) if the isValid flag of this field is set to null and if so, return true. This should be the case anyway (at least in my opinion), because if a field has no boolean value for "isValid" it surely must be validated again.

Code is attached.