Skip to content
This repository has been archived by the owner on Nov 10, 2018. It is now read-only.

Fixed hasError to also return custom error messages #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bofrede
Copy link

@bofrede bofrede commented Sep 26, 2017

Error messages set by setCustomValidity was ignored.

@cferdinandi
Copy link
Owner

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.

@bofrede
Copy link
Author

bofrede commented Sep 29, 2017

@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.

@michapietsch
Copy link

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 michapietsch@94022b0. Maybe you find it useful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants