Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML5 constraint validation #17

Open
kevinmickey opened this issue Jun 19, 2016 · 1 comment
Open

HTML5 constraint validation #17

kevinmickey opened this issue Jun 19, 2016 · 1 comment

Comments

@kevinmickey
Copy link

It might make sense to use HTML5 constraint validation, in particular setCustomValidity().

See https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation#Constraint_API's_element.setCustomValidity()

@msigley
Copy link
Contributor

msigley commented Sep 19, 2016

There are only currently two client side validations done in the script:
https://github.com/mailgun/validator-demo/blob/master/mailgun_validator.js#L77-L80
Both of which are very fast because they only use string functions.

We actually don't want to completely validation the domain name on the client side to take advantage of mailgun's "Did you mean?" feature to help the user correct their input, otherwise the built in browser email validation in the HTML5 Validation API would be a nice optimization to the script.

Safari currently doesn't actually display the validation message to the user when it blocks the form submission:
http://caniuse.com/#feat=form-validation
Until that is resolved it is probably best to not use setCustomValidity() to avoid displaying two error messages to the user.

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

No branches or pull requests

2 participants