Apologies for not reading more closely. And now that I have, I'm a little confused. Your original post said "But it just seems to ignore this validation whatever I set the form page property to". But below, you say "the form always gets validated. Even when the page is set to a number where the fields have not been set".
Are the validations firing, just not when you expect, or not firing at all? If not at all, have your set "validate" to "true" in your <action> def in struts-config? (BTW, if I'm off in the weeds, let me know that too. I've done this with a collection of JSP pages sharing a form def, but not via StrutsTest.) Jay http://www.vtgroup.com/ -----Original Message----- From: Jack Perrett [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 22, 2005 11:58 AM To: Struts Users Mailing List Subject: Re: multi-page validation form No. I don't actually have a jsp page. I'm generating a form in a StrutsTest and then testing what my action does with it. It looks like this: public void testAction() { setRequestPathInfo("/myAction.do"); setActionForm(populateForm()); actionPerform(); verifyForward("correctActionForward"); verifyNoActionErrors(); } public form populateForm() { MyForm form = new MyForm(); form.setMyField1(); form.setMyField2(); form.setPage(1); // This sets the page variable in the form return form; } So anyway, the form always gets validated. Even when the page is set to a number where the fields have not been set any ideas? ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <user@struts.apache.org> Sent: Tuesday, March 22, 2005 5:28 PM Subject: RE: multi-page validation form > Having done exactly the same thing, I know it works (though it's been a while so > I'm trying to remember everthing I've done). Do you also have a page number > defined for the Javascript include tag e.g. > > <html:javascript formName="myForm" page="3"/> > > Jay > http://www.vtgroup.com/ > > > -----Original Message----- > From: Brandon Mercer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 22, 2005 11:15 AM > To: Struts Users Mailing List > Subject: Re: multi-page validation form > > Jack Perrett wrote: > > >All the previous form properties are set using the StrutsTest so all the > >required fields are in the form. This is not the issue however, the > >validation is just plain ignoring the validation, whatever the form property > >is set to - it should at least be performing the valiadtion on the fields > >with the correct page value but is just ignoring these. > >The documentation her does suggest that it will perfrom the validation on > >any fields with a page property set less than or equal to the form page > > > > > Ahhh yes, but you said GREATER than or equal to with the logic you > wrote. I was just making sure ;-). Another thing I'd check is to see > if there are any typo's in the validation.xml file. Make sure the form > defined in the struts-config is the same as the one in the > validation.xml... I've had that cause validation not work. Other than > that, I don't think I can offer much more help. Good luck! > Brandon > > >property > >http://struts.apache.org/userGuide/dev_validator.html > > > > > > > >----- Original Message ----- > >From: "Brandon Mercer" <[EMAIL PROTECTED]> > >To: "Struts Users Mailing List" <user@struts.apache.org> > >Sent: Tuesday, March 22, 2005 4:29 PM > >Subject: Re: multi-page validation form > > > > > > > > > >>Jack Perrett wrote: > >> > >> > >> > >>>Thanks for gettig back to me so quickly. > >>>I am actually setting the hidden page property. I'm using a StrutsTest so > >>>the jsp doesn't actually exist at the moment but I'm creating a form, and > >>>setting the fields, and then using > >>> > >>> form.setPage(2); > >>> > >>>to set the this property. So I'm effectively submitting a form with the > >>>hidden page property set to 2. > >>>any ideas what else could be stopping it? > >>> > >>>----- Original Message ----- > >>>From: "Brandon Mercer" <[EMAIL PROTECTED]> > >>>To: "Struts Users Mailing List" <user@struts.apache.org> > >>>Sent: Tuesday, March 22, 2005 4:04 PM > >>>Subject: Re: multi-page validation form > >>> > >>> > >>> > >>> > >>> > >>> > >>>>Jack Perrett wrote: > >>>> > >>>> > >>>> > >>>> > >>>> > >>>>>I'm trying to create a form that will be validated over a series of > >>>>> > >>>>> > >>>>> > >>>>> > >>>jsp's. I'm using the page property with individual fields to specify > >>> > >>> > >whether > > > > > >>>they should be validated on a particular page and then setting the hidden > >>>page property to whatever the corurrent jsp page. > >>> > >>> > >>> > >>> > >>>>>This is how my field looks in the validation.xml > >>>>> > >>>>><field property="adults" > >>>>> page="2" > >>>>> depends="required"> > >>>>> > >>>>> <arg0 key="passengerBookingForm.adults"/> > >>>>></field> > >>>>> > >>>>>But it just seems to ignore this validation whatever I set the form > >>>>> > >>>>> > >page > > > > > >>>>> > >>>>> > >>>property to. I'm expecting it to perform this validation if the form page > >>>property is >= 2, and ignore the validation altogether if the form page > >>>property is < 2. > >>> > >>> > >>> > >>> > >>It's not going to validate this page when it's GREATER than or = to 2... > >>only if it's value is two. That's the first thing. The second thing > >>is, that in your JSP you need to also have hidden fields for the form > >>fields you've collected on the previous pages. Like this. > >><html:hidden property="previousvalue"/> > >><html:hidden property="previousvalue2"/> > >><html:hidden property="previousvalue3"/> > >>:-) > >>Brandon > >> > >>--------------------------------------------------------------------- > >>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]