W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2013

Re: [whatwg] Can the maximum allowed value length be changed to restrict the number of characters?

From: Charles McCathie Nevile <chaals@yandex-team.ru>
Date: Thu, 22 Aug 2013 18:01:13 +0500
To: whatwg@lists.whatwg.org, "Boris Zbarsky" <bzbarsky@mit.edu>
Message-ID: <op.w176sbizy3oazb@dhcp235-171-red.yandex.net>
On Tue, 20 Aug 2013 19:33:12 +0500, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 8/19/13 7:40 PM, Ryosuke Niwa wrote:
>> Also,  
>> http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-maxlength-attribute  
>> says "if the input element has a maximum allowed value length, then the  
>> code-unit length of the value of the element's value attribute must be  
>> equal to or less than the element's maximum allowed value length."
>>
>> This doesn't seem to match the behaviors of existing Web browsers
>
> The spec bit you quote above is an _authoring_ conformance requirement.  
>   That is <input maxlength="2" value="abc"> is not valid HTML and a  
> validator would flag it as invalid.  What UAs do with this markup, on  
> the other hand, is defined by the UA conformance requirements, and what  
> they do is allow a value longer than maxlength if it's specified.
>
>> or  
>> http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#maximum-allowed-value-length
>
> These are the UA conformance requirements in question.
>
>> The paragraph should be revised to mention and only mention that the  
>> maxlength attribute affects the validation and the user agents may  
>> prevent the user from typing more characters than the specified value.
>
> The basic question is whether a validator should flag <input  
> maxlength="2" value="abc"> as a conformance error or not.  It seems to  
> me like it should.

Why? It seems that it generally works in browsers, and has for a long time.

On the other hand the use cases I can think of have mostly been taken over  
by placeholder, and pattern with good labelling, and so on.

cheers

-- 
Charles McCathie Nevile - Consultant (web standards) CTO Office, Yandex
       chaals@yandex-team.ru         Find more at http://yandex.com
Received on Thursday, 22 August 2013 16:01:47 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:23 UTC