GeeCON Prague 2014*
The moose likes Struts and the fly likes Attribute id invalid for tag text according to TLD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Attribute id invalid for tag text according to TLD" Watch "Attribute id invalid for tag text according to TLD" New topic
Author

Attribute id invalid for tag text according to TLD

Ben Hagadorn
Greenhorn

Joined: Mar 28, 2006
Posts: 25
I am currently using Struts 1.2 in my application. Government regulations require that I comply with 508 accessibility rules, one of which is:

For each FORM control, place its label in a LABEL element. A LABEL is attached to a specific form control through the use of the "for" attribute. The value of the "for" attribute must be the same as the value of the "id" attribute of the form control.

For example:

<FORM action="http://somesite.com/foo" method="get">
<LABEL for="name">Name:</LABEL><br/><INPUT type="text" id="name" SIZE="50">



I currently have code that looks like this:


<LABEL for="userName">User ID :</LABEL>
<html:text id="userName" property="userName" size="15"/>


Initially, this caused the following server error:
Attribute id invalid for tag text according to TLD

I then modified the struts-html.tld file and added this code to the <name>text</name> section:

<attribute><br/> <name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>


this resolved the server error but when the page renders the resulting HTML does not have the ID tag:

<LABEL for="userName">User ID :</LABEL>
<input type="text" name="userName" size="15" value="" />


Can anyone help here? I need to find a way to get the final HTML to have an ID tag in it.

Thanks for the help.

- Ben Hagadorn
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Go back to using the original TLD for the <html:text> tag, and specify styleId="name". When the HTML input tag is rendered, "styleId" will be rendered as "id".


Merrill
Consultant, Sima Solutions
Ben Hagadorn
Greenhorn

Joined: Mar 28, 2006
Posts: 25
Merrill,

Thanks so much for your help - that did the trick!
Ben Hagadorn
Greenhorn

Joined: Mar 28, 2006
Posts: 25
Merrill,

Thanks so much for your help - that did the trick!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Attribute id invalid for tag text according to TLD