[ic] Keeping the "selected" tag up
Grant
listbox at email.com
Mon Oct 27 14:11:22 EST 2003
> > Quoting Grant (listbox at email.com):
> > > The selected tag seems to be designed to be used to output HTML
> > like this:
> > >
> > > <option SELECTED value="1">1
> > >
> > > but the proper method is specified here:
> > > http://www.w3schools.com/tags/tag_option.asp as:
> > >
> > > <option selected="selected" value="1">1
> >
> > They can say it is the proper way, but the HTML spec differs. It is an
> > attribute that has an implicit value, and you need not add ="selected".
>
> I'm going to go straight to the HTML spec from now on.
>
> >
> > HTML 4.0 spec 17.6:
> >
> > In this example, we create a menu that allows the user to select which
> > of seven software components to install. The first and second
> > components are pre-selected but may be deselected by the user. The
> > remaining components are not pre-selected. The size attribute states
> > that the menu should only have 4 rows even though the user may select
> > from among 7 options. The other options should be made available
> > through a scrolling mechanism.
> >
> > The SELECT is followed by submit and reset buttons.
> > <FORM action="http://somesite.com/prog/component-select" method="post">
> > <P>
> > <SELECT multiple size="4" name="component-select">
> > <OPTION selected value="Component_1_a">Component_1</OPTION>
> > <OPTION selected value="Component_1_b">Component_2</OPTION>
> > <OPTION>Component_3</OPTION>
> > <OPTION>Component_4</OPTION>
> > <OPTION>Component_5</OPTION>
> > <OPTION>Component_6</OPTION>
> > <OPTION>Component_7</OPTION>
> > </SELECT>
> > <INPUT type="submit" value="Send"><INPUT type="reset">
> > </P>
> > </FORM>
> >
> > Note they, in their authoritative example, do not use it in the
> > way you say is proper. In fact, they recommend you don't do it
> > that way.
> >
> > B.3.4 Boolean attributes
> >
> > Authors should be aware that many user agents only recognize the
> > minimized form of boolean attributes and not the full form.
> >
> > For instance, authors may want to specify:
> > <OPTION selected>
> >
> > instead of
> > <OPTION selected="selected">
> >
>
> That's very interesting, I didn't realize that at all. I'm going to look
> into other HTML tag attributes that might need to be specified in a
> minimized form.
>
> - Grant
>
> >
> > --
> > Mike Heins
After some poking around it looks like selected="selected" is required for
XHTML which is supposed to replace the HTML spec right?
- Grant
More information about the interchange-users
mailing list