This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18774 - I believe that there are significant shortcomings in the HTML5 form validation specifications which could easily be remedied by a few simple additional features: Firstly, I would like to suggest the addition of a boolean "auto trim" attribute for text inp
Summary: I believe that there are significant shortcomings in the HTML5 form validatio...
Status: RESOLVED DUPLICATE of bug 17972
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-04 20:34 UTC by contributor
Modified: 2012-10-19 23:06 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2012-09-04 20:34:24 UTC
Specification: http://dev.w3.org/html5/spec/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
I believe that there are significant shortcomings in the HTML5 form validation
specifications which could easily be remedied by a few simple additional
features:

Firstly, I would like to suggest the addition of a boolean "auto trim"
attribute for text input fields. The effect of setting this attribute would be
to have the browser automatically remove leading and trailing whitespace from
the entered value before testing validation constraints. Without such a
facility, the benefit of the 'required' attribute is severely compromised, as
a user can simply enter a single space to bypass the 'required' check, even
though the application may have every intention of trimming user input before
accepting it. As things stand, whenever an application intends to trim a value
it then needs to recheck whether any value (other than pure whitespace) was
supplied and, when this is not the case, it needs to raise a custom error that
effectively duplicates the browser check. And, if the application is thus
compelled to make such a check, it makes sense to abandon use of the
'requires' attribute, to avoid the performance overhead of a then pointless
validation check by the browser.

Secondly, given that HTML5 provides a 'min' (numeric value) attribute, a 'max'
(numeric value) attribute and a maxLength (value length) attribute, it seems
inconsistent that there is no minLength attribute. Often, e.g. for passwords
or zip codes etc, there is a minimum length constraint that an application
needs to apply to input data. I believe that it would therefore be beneficial
to add a minLength attribute - which could have a default value of 0 or 1,
depending on the setting of the 'required' attribute. In fact, after adding a
minLength attribute, the only residual function of the 'required' attribute
would be to influence the default value for minLength.	  


Posted from: 99.250.102.43
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.26 Safari/537.4
Comment 1 Ian 'Hixie' Hickson 2012-10-19 23:06:35 UTC
For the first issue, see bug 17972.

For the second, see bug 10053.

*** This bug has been marked as a duplicate of bug 17972 ***