Hi Ashish,
If you're using Struts 2, and the xhtml/css_xhtml theme, the template
for each field in the form includes "controlheader-core.ft" that
provides the logic to include the html to report field errors.
Here is an extract:
<#assign hasFieldErrors = parameters.name?exists && fieldErrors?exists
&& fieldErrors[parameters.name]?exists/>
<#if hasFieldErrors> ....
You have two reasonable ways to enhance this:
option a. create your own template from the original that uses the same
logic to change the style of the fields in your form when there's an
error (recommended approach)
See http://struts.apache.org/2.0.9/docs/themes-and-templates.html
option b. This is a bit of a hack, but simple. Write some javascript
that gets all labels from the DOM with class errorLabel. The "for"
attribute of each label element contains the Id of an element in the
form with an error. Change the style of those elements using javascript.
Hope that helps,
Jeromy Evans
ashish agarwal wrote:
Hi All,
I am developing a form using jsp. If validation fails then I want those fields
to be highlighted . I am able to print error message on top but not able to
highlight the text( for example UserName(if it contains less characters)).
Please somebody suggest some solution for this.
Thanks
Ashish
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.11/1093 - Release Date: 25/10/2007 5:38 PM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]