guillaumepotier/Parsley.js — pull request #459 by hwsoderlund (2013-12-11 10:17:35+00:00)
Title: Fix for bug that caused error messages not to be updated correctly + added an option to turn off automatic parsing of html 5 constraints

First of all, thanks for an excellent library. I have made two changes. I suppose I should have created two separate pull requests, but I couldn't get my head around how to do that. There are also a couple of commits in there that you can disregard completely. Anyway:

1. Commit d49b7f9 - Added option to turn off automatic parsing of html 5 validation constraints. The reason I need this is that I need to use pattern="[0-9]*" together with parsley-regexp="^[0-9]{5}$". The pattern attribute is just to force Safari mobile to display the numeric keypad, while the parsley-regexp attribute should be used for the actual validation. Turning off the automatic parsing of the html 5 attributes allows the two attributes to co-exist peacefully. This fix also solved another problem I was having: I had a phone number field with type="tel", which made parsley automatically validate for a specific phone number format. I had a more specific validation pattern (for swedish mobile phone numbers) set in the regexp attribute but that clashed with the default phone validation. Again, the only reason for me to use type="tel" is to force mobile browsers to display the correct keypad for the field

2. Commit 7f45b49 - The scenario: I had created a custom validator to validate e-mail addresses. The validator first checks the format of the address. Once the address has the correct format an ajax request is made to the server to make sure the address is not already registered.
The problem: If a field was first set to invalid due to an incorrect format and then later set to invalid again, but this time with another error message ("e-mail address already registered"), the message would not be updated in the UI.
My fix makes sure that an error message is always updated even if the isValid (or whatever) parameter remains unchanged. I suppose you may want to solve this in a different way, such as changing the addError method instead of adding an updateError method like I did. Your choice.

Regards,
/Henrik