Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Attribute id invalid for tag text according to TLD

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Merrill,

Thanks so much for your help - that did the trick!
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic