-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SF,
Struts2 Fan wrote: > <s:textfield name="age" theme="simple"/><div name="ageerror"><img > src="images/hata.jpg"></div> > </td> > > I want to define a validation for Age field as it is an example on > the site. But if it is an invalid field I want the "ageerror" div to > be visible and if not invisible. You should be able to do this no matter what version of Struts and validator you are using. First of all, you need to change your error message in your validator config ('required' and 'mask' are just examples of validations to perform on this field): <field name="age" requires="required, mask"> <msg name="required" bundle="myBundle" key="error.ageerror" /> <msg name="mask" bundle="myBundle" key="error.ageerror" /> . . . </field> This will configure your message "error.ageerror" for display whenever there is an error with your "age" field. In this way, you can override the default error message that is displayed by any validator for any field. Next, you need to configure your age error message in your bundle file: myBundle.properties: error.ageerror=<div name="ageerror"><img src="images/hata.jpg" /></div> Finally, simply use the existing error message JSP tags (I am unfamiliar with them since I don't use JSP, but I'm sure it's something like this:) <s:textfield name="age" theme="simple" /> <s:errormsg fieldName="age" /> That's all you should need. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFxRwL9CaO5/Lv0PARAorhAJ9XOKWRNmsvb/gzSMBWm/G7z8INsQCeKns+ X9TwBK8XmiSqG8P/hVBmhag= =aKRT -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]