• 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

struts validation

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks,

I am currently using ValidatorForm for my validations. Since most of the validations are available in the struts provided default validations, I am making use of the same.
However, I'd like to highlight (in red) the form field which is causing the validation to fail. How do I accomplish this? From the <html:errors>, is it possible to know which field(s) has caused the error?

Appreciate your assistance!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the <logic:messagesPresent> tag. If you specify a property attribute in this tag, the body will be executed only if there is an error message present for that field. Example:

[ July 09, 2007: Message edited by: Merrill Higginson ]
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for the delayed reply!
I tried it just now as some other tasks took priority and this worked just great for me.

Thank you Merrill!!
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For an example on Highlighting Error Fields you can refer here.

Struts Highlighting Error Fields

regards
Struts Developer

 
reply
    Bookmark Topic Watch Topic
  • New Topic