I have not attempted what you are trying to do yet but I am
very soon.  So while I was thinking about it...

For the example you gave should you have used requiredif instead
of required as the depends value?

Also, I think it might be easier to Use a DynaValidatorActionForm
and then have validation done like so:

Assume your ActionForm in session scope.

validation.xml:

<form name="/pageOne">
    <field property="field1" depends="required" />
    <field property="field2" depends="required" />
    <field property="field3" depends="required" />
</form>
<form name="/pageTwo">
    <field property="field4" depends="required" />
    <field property="field5" depends="required" />
    <field property="field6" depends="required" />
</form>
<form name="/pageThree">
    <field property="field7" depends="required" />
    <field property="field8" depends="required" />
    <field property="field9" depends="required" />
</form>

struts config:
<action path="/pageOne"
        name="theForm"
        ... />
<action path="/pageTwo"
        name="theForm"
        ... />
<action path="/pageThree"
        name="theForm"
        ... />


Since the ValidatorActionForm family validates per action
and the ValidatorForm family validates per form won't this
work?




-----Original Message-----
From: Jordan Reed
To: Struts Users Mailing List
Sent: 6/13/2003 9:38 PM
Subject: Re: conditional validation in validation.xml

The Validator has some concept with the page attribute.  If you look at
the
"Multi Page Form" section you get a hint at it:
http://jakarta.apache.org/struts/userGuide/dev_validator.html


In your jsp you need an element called page.  I usually just put a
static
hidden tag:
<html:hidden property="page" value="2"/>

Then in your validation.xml you associated a page number with the
element:
<field property="user.firstName" depends="required" page="2"/>

So what the validator does is only validate the field if the page
attribute
is >=.

So for this example above... The "user.firstName" field would NOT be
validated on page 1, but would be validated on page 2, page 3, etc.

-Jordan Reed (http://www.chaosserver.net)



On 6/13/03 5:40 AM, "Gregory F. March" <[EMAIL PROTECTED]> wrote:

> 
> I'm using a DynaValidatorForm with validation rules in
> validation.xml.  My form is a multipage form, and I (obviously) would
> like to validate only the parameters "in scope" for the current page.
> 
> Can this be done through the xml file (if so, how)?  Or do I need to
> write my own validation class that looks at a "page" variable?
> 
> Thanks!
> 
> /greg
> 
> --
> Gregory F. March    -=-    http://www.gfm.net:81/~march    -=-
AIM:GfmNet


---------------------------------------------------------------------
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