HighDots Forums  

Label outside of form

HTML Writing HTML for the Web (comp.infosystems.www.authoring.html)


Discuss Label outside of form in the HTML forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Spartanicus
 
Posts: n/a

Default Label outside of form - 06-28-2004 , 11:42 AM






Is this correct usage of <label>?:

<h5><label for="sp-q"><img src="search.png" alt="Search"></label></h5>
<form method="get" action="http://search.atomz.com/search/">
<div>
<input name="sp-q" id="sp-q">
<input type="submit" value="Search this site">

[...]

</div>
</form>

The accessibility checker cynthiasays.com doesn't accept this as
correct, Nick's Accessibility Valet doesn't complain.

--
Spartanicus

Reply With Quote
  #2  
Old   
Chris Morris
 
Posts: n/a

Default Re: Label outside of form - 06-28-2004 , 11:50 AM






Spartanicus <me (AT) privacy (DOT) net> writes:
Quote:
Is this correct usage of <label>?:
Aside: I'm impressed if it's correct use of <h5> - what document are
you doing that has that many heading levels?

Quote:
h5><label for="sp-q"><img src="search.png" alt="Search"></label></h5
form method="get" action="http://search.atomz.com/search/"
div
input name="sp-q" id="sp-q"
input type="submit" value="Search this site"

[...]

/div
/form

The accessibility checker cynthiasays.com doesn't accept this as
correct, Nick's Accessibility Valet doesn't complain.
I think that's probably okay, at least as far as use of <label>
goes. In practical terms, try using a modern browser and clicking on
the image - see if it focuses the input.

I'd be tempted to put the <h5> inside the <form> and possibly inside
the <div>, too.

Obviously you'll need to make sure that the image is accessible
(sensibly large font size, good colour contrast, etc).

--
Chris


Reply With Quote
  #3  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: Label outside of form - 06-28-2004 , 11:54 AM




"Spartanicus" <me (AT) privacy (DOT) net> wrote

Quote:
Is this correct usage of <label>?:

h5><label for="sp-q"><img src="search.png" alt="Search"></label></h5
form method="get" action="http://search.atomz.com/search/"
div
input name="sp-q" id="sp-q"
input type="submit" value="Search this site"

[...]

/div
/form

The accessibility checker cynthiasays.com doesn't accept this as
correct, Nick's Accessibility Valet doesn't complain.
In terms of valid HTML, the LABEL element can go anywhere any form control
can go except inside another LABEL. This means, in turn, that it can go
anywhere *any* inline code can go except inside a BUTTON.

I don't see anything in the spec that requires the LABEL to be physically
inside the form that contains the control to which it applies. Since it's
not a control--it doesn't have a value that gets posted with the form--I
expect that it doesn't matter. But I suggest checking out what a few
browsers actually do in such a case.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.