Re: Proper Form Coding

At 12:04 PM 2000-04-14 -0700, Kelly Ford wrote:
>Hi All,
>
>Again if there are pointers on this please direct me to appropriate
>resources.  I've been experimenting with ways to ensure that a screen
>reader will read the correct text for things like edit boxes and such on
>forms.
>
>If I exclude the table references in the below example I hear all the text
>read as a prompt.  If I include the table references I only hear the direct
>instruction to enter a name.
>
>What's the best way to code things so a screen reader will only read the
>direct instruction?  Is my method acceptable?
>
><FORM METHOD="POST" ACTION="bogus-script"> 
>An edit box is where you type information.
><p>
><table>
><tr>
><td>
>Please enter your name:
><INPUT TYPE="text" NAME="name">
></td>
></tr>
></table>
><p>

The HTML 4 structure for this is the LABEL element. 

What you do is to wrap the specific instructions for this field in a LABEL
element, give the associated INPUT form control an ID attribute, and use
the ID of the form control as the value of the FOR attribute on the LABEL.

<LABEL FOR="X0001">Please enter your name:</LABEL> <BR>
<INPUT TYPE="text" ID="X0001" NAME="name"> <BR>

..etc.

I do not know what different browsers and screen readers will produce with
this, but that is the 'right' way to do it and thus the first thing to try.

You may still get the full streaming text when you cruise in "read page"
mode but tabbing to the form control should get you just its own
instructions if marked this way.  At least that is what the markup is there
to suppport.  

Note that for older browsers and screen readers you will get better results
if you leave the label on the line with the form control:

<LABEL FOR="X0001">Please enter your name:</LABEL>
<INPUT TYPE="text" ID="X0001" NAME="name"> <BR>

Two references:

 LABEL - Form Field Label
 http://www.htmlhelp.com/reference/html40/forms/label.html

 LABEL
 http://www.w3.org/TR/html401/interact/forms.html#edef-LABEL

Al



> 

Received on Friday, 14 April 2000 17:09:48 UTC