W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2011

[whatwg] Three concerns regarding HTML5 form validation

From: Matias <matiasnu@gmail.com>
Date: Mon, 26 Sep 2011 13:58:52 +0200
Message-ID: <70FE1D13-DE15-4BE0-B3BE-0B4950510C25@gmail.com>
Hi,

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;

1) Is there a reason why native form validation seems to be tied to the click of the submit button? Submitting the form using JavaScript does not seem to trigger HTML5 form validation in either Firefox, Opera or the Webkit browsers (I haven't checked how IE10 behaves yet). To me this seems like an unnecessary limitation.

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.

Best regards,
Matias Larsson
Received on Monday, 26 September 2011 04:58:52 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:36 UTC