I'm trying to validate a form using the Constraint Validation API to customize error messages.
According to mozilla (https://developer.mozilla.org/en-US/docs/HTML/Forms/Data_form_validation) everything should work, but I have a strange bug when I try to validate a simple mail input, invalid mail is not detected.
Here a sample of my code :
<input type="mail" id="mail" name="mail"/>
then the object is stored in JS, and I check in console with :
console.log(field.get(0).validity);
The answer from the console is :
customError : false
patternMismatch : false
rangeOverflow : false
rangeUnderflow : false
stepMismatch : false
tooLong : false
typeMismatch : false
valid : false
valueMissing : true
So I assume the function call is working.
If I leave the input empty, same answer. If I put "a" or random string, same answer. If I put a valid mail, same answer...
If I put a required attribute, emptyness is detected...
Do you know what's happening ?
Is the API too young to be used, or I missed something ?
What can I use as alternative ?
Thanks for reading, and sorry for my english.