[whatwg] Constrains of the value propety of Controls

Ian Hickson ian at hixie.ch
Tue Oct 28 01:35:49 PDT 2008


On Fri, 20 Oct 2006, Joao Eiras wrote:
>
> Value isn't readonly, and you might not have an index but a string.
> I'm not asking help how to code. I'd like to know what happenns in case
> 'VALUE' is set .
>
> Master Br <master at sitesbr.net> escreveu:
> 
> > I think that the correct approach is to define the SELECTED INDEX of 
> > the list, never to try setting the list value directly. Indeed, I 
> > think that the value property is READ-ONLY in this case... so you can 
> > NOT set
> > 
> > Right approach:
> > objectSelect.selectedIndex = DESIRED_INDEX;
> > 
> > Joao Eiras escreveu:
> > > 
> > > Currently, no DOM specification explicitly defines behaviour and 
> > > restrictions when setting the value of the value property for 
> > > elements part of forms, like select, option, and input. That's 
> > > however, work that's being done at WHATWG.
> > >
> > > Yet, one single case persists:
> > >
> > >  - the value property of a HMTLSelectElement is a limited domain, 
> > > formed by the value of the select's child option elements value 
> > > property.
> > > 
> > > Is this a valid assertion ?
> > >
> > > What is expected to happen when a script tries to set the value of 
> > > the value property of a select element, value which doesn't exist 
> > > among it's children ? Should the value remain unchanged ? An error 
> > > thrown ?

I have attempted to answer this question in the HTML5 specification. 
Please let me know if the resulting text is inadequate.

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list