Puneet Lakhina wrote:
Hi,
I have the following key value pair in ApplicationResource.properties
required = <li>{0} is required.</li>
I used this when I was doing only server side validation, to display a list
of error messages when some validation failed.
Now Im using the <html:javascript> to do the same thing on client side
also.
But my problem is that now i get error messages like
<li>Name is required</li>
<li>Status is requried</li>
in an alert box on the jsp page when i submit with some validation
errors. I
would like to maybe use different error messages for what is displayed on
the client side. Is that possible??
Following is my validation.xml
<?xml version="1.0" encoding="UTF-8"?>
<form-validation>
<formset>
<form name="requestForm">
<field property="name" depends="required">
<msg name="required" key="required" />
<arg0 key="Name" resource="false" />
</field>
<field property="status" depends="required">
<msg name="required" key="required" />
<arg0 key="Status" resource="false" />
</field>
</form>
</formset>
</form-validation>
Im using struts 1.1
AFAIK, there's no way to use different validation messages client-side
and server-side. However, what you should be able to do is remove the
markup from the error messages you have, and use the server-side error
reporting tags to insert it.
How you achieve the server-side part of that depends on how you display
your error messages. If you use html:errors, you can use the
errors.header, errors.footer, errors.prefix and errors.suffix resources
[1]. If you use the html:messages tag [2], you would put the markup
directly into your JSP / view.
L.
[1] http://struts.apache.org/1.2.9/userGuide/struts-html.html#errors
[2] http://struts.apache.org/1.2.9/userGuide/struts-html.html#messages
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]