Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attribute id invalid for tag text according to TLD

 
Ben Hagadorn
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
Ben Hagadorn
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merrill,

Thanks so much for your help - that did the trick!
 
Ben Hagadorn
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merrill,

Thanks so much for your help - that did the trick!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic