W3C home > Mailing lists > Public > public-webapi@w3.org > June 2008

Re: [web forms 2]Behavior of maxlength on scripted value changes

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 5 Jun 2008 22:32:40 +0000 (UTC)
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: "Web APIs WG (public)" <public-webapi@w3.org>
Message-ID: <Pine.LNX.4.62.0806052229200.6527@hixie.dreamhostps.com>

On Thu, 5 Jun 2008, Boris Zbarsky wrote:
> The section on maxlength in
> http://www.whatwg.org/specs/web-forms/current-work/ (the 12 October 2006
> version) says nothing about what happens if script on the page (or script from
> a bookmarklet, whatever) does:
>   myInput.value = "some long string";
> where the string length is longer than myInput.maxlength.

The spec scatters the definitions around a bit (this will be solved 
when WF2 is merged with the rest of HTML5, and is a legacy of the "diff" 
design of the spec as opposed to a self-contained spec) but actually this 
is defined in the DOM section:

# Setting a control's value DOM attribute dynamically in such a way that 
# it makes the control invalid because the value doesn't conform to the 
# attributes setting constraints on the value, however, must cause the 
# control to be set to the new value, and the control becoming invalid. 
# (For example setting the value of a text control to a string that is 
# longer than the maxlength attribute specifies would set the control to 
# that long value, but then prevent submission.) 

(Note that the "prevent submission" thing is new behaviour due to the 
client-side validation in WF2. If this turns out to be incompatible with 
the Web, we'll have to change it somehow, maybe by keeping track of 
whether the value was set by script or not.)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 5 June 2008 22:33:20 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:27 UTC