You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Matt Raible <ma...@raibledesigns.com> on 2002/11/25 19:10:33 UTC

Enhancement Request - add label and labelKey to form elements

I thought I'd run this idea by the development team before entering it
into Bugzilla.

One of the items that is required with 508 compliance is a <label> value
for each form element:

For example:

<label for="name">Name:</label> 
<input type="text" id="name" size="50" name="name" />

More information at: http://www.csuohio.edu/uctl/508/forms.html

This would typically be rendered with Struts tags using:

<label for="name">Name:</label> 
<html:text name="name" styleId="name" size="50"/>

To make it easier, we could do:

<html:text name="name" styleId="name" size="50" label="Name:"/> OR
<html:text name="name" styleId="name" size="50" labelKey="prompt.name"/>

The problems I see with this are that you lose some control over the
presentation (i.e. a <br /> after the label or labels in a separate
<td>).  However, it might be useful for rapid prototyping and
code-generating tools.  My hope someday is that the JSP simply renders
XML, and then an XSL stylesheet is applied, and in this case, the
presentation issues would disappear?

What does everyone think?  Would anyone use it?

Thanks,

Matt



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Enhancement Request - add label and labelKey to form elements

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Mon, 25 Nov 2002, Matt Raible wrote:

> Date: Mon, 25 Nov 2002 11:10:33 -0700
> From: Matt Raible <ma...@raibledesigns.com>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: Enhancement Request - add label and labelKey to form elements
>
> I thought I'd run this idea by the development team before entering it
> into Bugzilla.
>
> One of the items that is required with 508 compliance is a <label> value
> for each form element:
>
> For example:
>
> <label for="name">Name:</label>
> <input type="text" id="name" size="50" name="name" />
>
> More information at: http://www.csuohio.edu/uctl/508/forms.html
>
> This would typically be rendered with Struts tags using:
>
> <label for="name">Name:</label>
> <html:text name="name" styleId="name" size="50"/>
>
> To make it easier, we could do:
>
> <html:text name="name" styleId="name" size="50" label="Name:"/> OR
> <html:text name="name" styleId="name" size="50" labelKey="prompt.name"/>
>
> The problems I see with this are that you lose some control over the
> presentation (i.e. a <br /> after the label or labels in a separate
> <td>).  However, it might be useful for rapid prototyping and
> code-generating tools.  My hope someday is that the JSP simply renders
> XML, and then an XSL stylesheet is applied, and in this case, the
> presentation issues would disappear?
>
> What does everyone think?  Would anyone use it?
>

I think a way to create <label> elements would be very useful.  I just
don't think we should embed it in the existing UI element tags (for the
reasons that others have articulated.

How about a new <html:label> tag instead.  Then, you could do things like
this on the logon page in struts-example:

  ...
  <tr>
    <th align="right">
      <html:label for="name">
        <bean:message key="prompt.username"/>
      </html:label>
    </th>
    <td align="left">
      <html:text styleId="name" property="username" size="16"
       maxlength="18"/>
    </td>
  </tr>
  ...

(I thought you tied labels to elements with the "id" ???)

The above approach assumes that it's not necessary to localize the element
id itself (which would really complicate attempts to generate JavaScript
event handlers), but you do (of course) need to localize the text of the
label.

This also imposes no restrictions on the mechanisms by which you manage
layout, and can be easily retrofitted onto existing pages.

> Thanks,
>
> Matt
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>