wood burning stoves 2.0*
The moose likes Struts and the fly likes how to highlight error field in struts html form? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to highlight error field in struts html form?" Watch "how to highlight error field in struts html form?" New topic
Author

how to highlight error field in struts html form?

Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
how to highlight error fields in struts html form when validation fails?

Note: Validations are performed on the server side (validate() method of respective form bean)


Abhishek
Bilal A. Siddiqui
Ranch Hand

Joined: Sep 14, 2008
Posts: 53

is it struts2 ??


Cheers!!! Bilal
Handsome Android||@bilal_speed||LinkedIn
Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
no iam using struts 1.2.9
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you're doing it right, and using Struts form tags, they'll be highlighted automatically, no?
Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
thanks for the reply........
sorry it is not happening........please let me know where i went wrong

this is what iam doing...



Note: where "name" and "id" refers to struts html field names?
do i need to make any addtional changes to make it happen?
Lei Guoguo
Greenhorn

Joined: Mar 31, 2009
Posts: 26
you can definited these key in your MessageResource.properties


in your html page you can used like this


I'm a chinese, my english is so bad, I need help. If you want to help me, you can send your question to my e-mail: lgg860911@yahoo.com.cn, I will help you, and improve my english. Thanks everyone.
amma mal
Greenhorn

Joined: Apr 15, 2009
Posts: 10
what I did is use resources.properties file there you have to give key ,value error details
in struts-config.xml use <message-resource> to include property file
give corresponding error property in validation xml file
it definetley works
Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
sorry guys.........i want my cursor focus on the error field when validation fails.

Please let me know, is it possible to retrieve the error field name on the client side when validation fails....



 
Don't get me started about those stupid light bulbs.
 
subject: how to highlight error field in struts html form?