[whatwg] Three concerns regarding HTML5 form validation
matiasnu at gmail.com
Mon Sep 26 04:58:52 PDT 2011
I don't know if this can/should be specified in the spec or if it's up to the browser implementors but here's some concerns I have regarding HTML5 form validation;
2) How about adding a method to programmatically display the native validation error messages instead of waiting for the form submit click? We already have a way to (more or less) detect if the form is valid or not, but no way of forcing the native validation error messages to render without using some submit button click hack.
3) Should there be a way of detecting if the browser actually understood all input element types? Browsers believe that a form is valid even when it contains invalid data for input types the browser doesn't understand. (Like the string 'asdf' in an input type=number field in Firefox.)
So checking if the browser has a checkValidity method is not a guarantee that the form validates according to the HTML5 specified constraints. If there was a method or property like form.containsUnknownInputs and maybe element.isUnknownInput (not the best names, but you get the idea) we could determine the best way to handle further validation.
I would love to hear your opinions on these issues which to me are quite serious impediments for a smooth validation implementation experience for web developers.
More information about the whatwg