Hi,

You can override method 
 public String getValidationKey(ActionMapping mapping,
                                   HttpServletRequest request) {..}

>From your ValidatorForm (it doesn't matter if it is dyna or not)

And return different validation keys for each button pressed.

Validation key identify the rules of validation.

The validation file will look then something like:

<form name="myAction_button1">
                 <!--if submit button 1 clicked, I validate the
following field>-->
                <field property="myProperty" depends="required">
                        <msg name="required" key="error.key1" />
                </field>   
</form>

<form name="myAction_button2">
                <!--if submit button 2 clicked, I validate the following
field>-->
                <field property="name" depends="myValidator">
                        <msg name="myValidator" key="error.key2" /> 
                </field>
</form>


alex

-----Original Message-----
From: Dave Newton [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 01, 2008 6:29 PM
To: Struts Users Mailing List
Subject: RE: Struts validator

--- "Zhang, Larry (L.)" <[EMAIL PROTECTED]> wrote:
> No, I am using struts 1.1,

Oh, wow.

Does validwhen[1] not exist in S1.1? You can always create a custom
validator
as well if you find your validation stretches what's easy to do with the
existing validation configuration possibilities. You may also be able to
combine declarative validation (via XML) and Java-based validation, although
it's been a pretty long time since I've thought about that :)

Dave

[1] http://struts.apache.org/1.1/userGuide/dev_validator.html (about 1/3 of
the way down)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to