On Wed, 14 Oct 2003, Gisle Aas wrote:
> John J Lee <[EMAIL PROTECTED]> writes:
[...]
> I could potentially let there be multiple 'value_names' for a single
> value, but I could also just let an explicit label override the option
> as per spec.  Is this something that real browsers implement?

I'm not sure I understand what you're asking.

Real browsers do implement the defaulting of OPTION values to OPTION
element contents (well, I tested Konqueror just now, and it does), and the
labels certainly do, of course.  So, if you have

<select name=foo>
 <option>1</option>
 <option>2</option>
</select>

You see 1 and 2 as the labels in the browser's GUI, and the server gets
sent foo=1, or whatever.

Personally, I chose to have users explicitly say that items are specified
by label if that's what they want -- otherwise, items are assumed to be
specified by value.  I can see that searching both sets of names for a
match by default might be better in some ways, though.


> The label just seems like a mechanism to get shorter labels when
> <optgroup> is used and as such the labels are likely not to be unique.
> That makes them bad names for selecting values.

I don't know why the label attribute was introduced, but I implemented the
feature because I ran into a page where the labels seemed less likely to
change than the values.

[...]
> > I see.  That's not a part of the HTML spec IIRC (unlike the case of
> > OPTION), but I guess it could be useful.
>
> I think so.  The problem is to know where to stop collecting text.  I
> implemented a new get_phrase method to HTML::TokeParser to get it to
> do what I think makes sense.  It will deal with stuff like:
>
>    <input name=sex type=radio value=F> <b>Fe</b>male
>
> in the expected way.

Officially, those <b>s aren't allowed, are they?  No surprise if you've
seen them 'in the wild', though :-(  Probably I should strip tags even for
OPTION element contents...


> >  Of course, there can also be explicit LABEL elements, but I suspect
> > people rarely use them, so probably not very useful.
>
> All the examples in the HTML4 spec use the label more like a prompt
> text and as such it is more an alternative name for the input.  The
> following example is given:
[...]

I see.  It can still be used for the list items of INPUT type=radio, or
whatever, though (though, as I said, probably rarely).


John

Reply via email to