Open bofrede opened 7 years ago
I'm not sure this will work in it's current form, since any other message other than the generic one will return first and the custom error will never surface.
@cferdinandi Thanks for your research and articles on HTML5 forms. It's good to finally being able to use HTML5 form validation.
I agree, that the generic errors are suppressing the custom error message, but without this fix, custom error messages are always ignored. So, while this solution may not be perfect, it's still a tangible improvement.
The fields I used custom errors on have been required fields, so I didn't miss an additional error message.
I don't think this is a problem. I use custom errors e.g. to validate the availability of a username or email address. In this case it makes perfect sense that first of all the visitor has to enter something, secondly it has to be of valid format and only then I will tell him about availability.
I just integrated support for setCustomValidity in https://github.com/michapietsch/validate/commit/94022b047c1a66bbcbc81eeedbaa31f790ab4f92. Maybe you find it useful.
Error messages set by
setCustomValidity
was ignored.