472,325 Members | 971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,325 software developers and data experts.

<label> with <select> in IE6

Hello,

I am used to using the label tag with check boxes and radio buttons in
html forms. This allows me to click on the text of the label to
activate/deactivate the check box / button, rather than having to
click on the (possibly small) box or button.

I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?

The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?

Is it wrong to assign a label to a select box?

Sample URL is: http://www.sindar.net/html-reference.html (scroll way
down to the bottom of the page).

Thanks,

Brian.
Jul 23 '05 #1
5 8157
Brian Foley wrote:
I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?
Most likely not. The Specification says only:

"When a LABEL element receives focus, it passes the focus on to its
associated control." [1]

There is no mention nor anything that would imply that an implementation
should move the selected entry, in the case of a menu element.
The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?
Hum... I can't think of anything decent.
Is it wrong to assign a label to a select box?
Definitely not!
Sample URL is: http://www.sindar.net/html-reference.html (scroll way
down to the bottom of the page).


I could confirm the reported (mis)behavior on MS IE 6.0.2900.2180 on
Windows XP SP2. Normally, one would suggest the submission of a bug
report, but I don't think IE is going to receive any attention before
Longhorn.

[1] http://www.w3.org/TR/html4/interact/forms.html#h-17.9.1

Regards,

--
Ney André de Mello Zunino
Jul 23 '05 #2
Ney André de Mello Zunino <zu****@inf.ufsc.br> wrote:
Normally, one would suggest the submission of a bug
report, but I don't think IE is going to receive any attention before
Longhorn.


After the recent announcement about IE 7 for Windows XP, I would be more
optimistic about this. Not very optimistic, though.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #3
/Brian Foley/:
The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?

Is it wrong to assign a label to a select box?


No, it is not wrong. It is just IE is wrong, as usual. :-)

Notice when you specify an 'accesskey' for the label (it is the only
way you could specify an 'accesskey' for a SELECT element) and use
that key to activate the select box - the "reset" behavior doesn't
happen.

--
Stanimir
Jul 23 '05 #4
Brian Foley wrote:
I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?

The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?


Here's a quick JavaScript workaround:
<http://tw.ecritters.biz/html_examples/ie_select_labels/>.
Jul 23 '05 #5
* Leif K-Brooks <eu*****@ecritters.biz> on Sun, 20 Feb 2005 06:45:42 -0500 wrote:
Here's a quick JavaScript workaround:
<http://tw.ecritters.biz/html_examples/ie_select_labels/>.


Thanks Leif -- very helpful.

I think, though, that it may simply be better to drop the labels from
my select elements. I usually lay my forms out in a two column th/td
table, so I suppose the relationship is obvious even without the
label.

Its a shame though...

Brian.
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: cedawe | last post by:
I have two select boxes. When the user picks a value in the first one it completely re-populates the second one. It works fine, but only generates...
10
by: Ryan McGeary | last post by:
In a <select> drop-down, the onchange event isn't called when scrolling through the dropdown using the mouse-wheel and when crossing over a new...
9
by: aragon | last post by:
Hi all, is it legal to use a fully-numeric string as "name" attribute for the <select> tag in the XHTML standard? E.g.: <form...
7
by: Cezary | last post by:
Hi. I want to change language on my site online. So, I wrote this: <form action="<?= preg_replace("/&/", "&amp;", $_SERVER) ?>" method="post"...
2
by: VK | last post by:
A while ago there was a discussion how to implement a select list that would call a function right upon new selection is being made w/o clicking...
7
by: lambertb | last post by:
Hi, is this possible to achieve this, and how? http://img217.imageshack.us/img217/779/derrrvw2.png thanks!
7
by: Smokey Grindle | last post by:
How can you correctly use the <labelelement in asp.net? does the label custom control corelate to this tag correctly in the same way in that if you...
3
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the...
12
by: LayneMitch via WebmasterKB.com | last post by:
Hello everyone. I'm currently learning Javascript and doing a few exercises. One problem I'm working on takes an array of names from an xml...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.