WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Adding a label to search box

for

From: Helen A
Date: Apr 11, 2006 10:00AM


At 15:55 11/04/2006,Emma Duke-Williams wrote:
>Hi
>I've got a blog athttp://www.tech.port.ac.uk/staffweb/duke-wie/blog/
>and thought I ought to check it for accessibility. There was one thing
>that it failed on, viz the lack of label for the search box. Following
>the notes on http://www.webaim.org/techniques/forms/4.php#input I've
>tried to add a label. (As there's only 1 box & so the button gives
>information for those that can see it, I figured that the best thing
>to do would be to add the label, check it validated, then hide the
>label).
>
>The code to generate the form is:
><form method="get" id="searchform" action="<?php echo
>$_SERVER['PHP_SELF']; ?>">
><div><input type="text" value="<?php echo wp_specialchars($s, 1); ?>"
>name="s" id="s" />
><input type="submit" id="searchsubmit" value="Search" />
></div>
></form>
>
>(Hope that comes out OK - gmail doesn't seem to have preview button!)
>
>I wasn't entirely sure if it was "s" or "searchform" that needed the
>label; whichever I put it ahead of though, I got an extra error - i.e
>the form still didn't have a label, and I also then had a label
>without a form!
Hi Emma,

Apart from the fact that when I preview the following:
<input type="text" value="<?php echo wp_specialchars($s, 1);
?>"name="s" id="s" /> I get the first 15 characters of the value I am
as bemused as you are as I thought Submit / Reset / Clear buttons
dont need labels. I'm assuming that your Search button performs in
the same way as a Submit button.

Helen

--
Why doesn't life come with an Undo button?

www.livingwithwheels.co.uk