Scripsit Harlan Messinger:
>> <a href="addNewPatient.php" target="_blank"><label>Add a new
>> patient</label></a>
>
> Anyone's ability to help you relies entirely on whether the problem
> happens to lie in the small fraction of your code that you've chosen
> to show us.
Not entirely. It also depends on the current state of anyone's crystal
ball and mind.
> As it happens, it's enough to see that you've used a LABEL tag without
> any indication of what it's supposed to be a label for.
It's also enough for seeing an interesting technical problem, though
it's not that interesting _pragmatically_. The problem vanishes in a
puff of logic, when the redundant <label> markup is removed (or <a> and
<label> are nested the other way around).
Still, we have a genuine browser bug here. No matter what sense <label>
might or might make inside <a>, it's valid and does not change the
defined meaning of <a>.
> What was your intention in using it?
An interesting question as such. Here's a case where it would make
sense:
<input type="checkbox" ... id="compr">
<a href="compr.html" title="Explanation of data compression applied">
<label for="id">Compressed</label></a>
That is, a normal combination of a field and its label, but with the
label turned into a link to a document that explains what the choice
means.
Of course, now that we know the bug, we can avoid it by nesting the
elements differently or using a different construct.
> I'm guessing that given the choice between having your click passed on
> to the handler for labels and the handler for hyperlinks, IE is
> choosing to pass it on to the handler for labels.
Sounds plausible. Interesting enough, IE (7) lets me focus on the text
in the label (when using <a ...><label>...</label></a>), showing the
focus rectangle. It also lets me activate something by hitting Enter,
but then weird things happen. So this inaccessible in an exceptional
sense: you can work with the keyboard, but not with the mouse: normal
clicking does not work.
Or _can_ you...? Yes, you can right click on the text and open the link
via the menu.
So here we have a partial answer to the question (asked somewhere
recently) "how do I make a link non-clickable?"
> If your label were
> tied to a control as it's designed to be, your click would activate
> or pass focus to the control. Since there is no associated control,
> nothing happens at all.
I actually tried to use the construct so that the label is tied to a
control, and the control is indeed activated when the label is clicked.
E.g., if the control is a checkbox, its state is toggled.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/