Are you using Struts 1.2.9? It contains EventDispatchAction
which allows your design to do both viewing of a form and processing
under one action mapping (or two, your choice).

As for the validation key, override the getValidationKey() of your
ValidatorForm or DynaValidatorForm. The string returned is the name
of the form to match in validation.xml

<form name="/myaction-step4">
...<var>...
</form>

So if you're keeping track of what step you're on, you can choose
the validation to run when you execute the next action.

Paul

--- "Chaudhary, Harsh" <[EMAIL PROTECTED]> wrote:

> What do you mean when you say "custom validation key"?
> 
> I am thinking about going with action chaining to solve this particular
> one. Like have every form call an action e.g. Dispatch and then call
> different actions to go with the page a user just came from e.g. if a
> user came from clienta.jsp, a form submit calls Dispatch.do which
> forwards to an action like clientaValidation.do which runs the
> validations and then calls the next forward.
> 
> Terrible design but this is in response to a change in our codebase
> which kind of messed things up a bit.
> 
> Harsh.
> 
> -----Original Message-----
> From: Paul Benedict [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 5:27 PM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: Re: Validation help: One struts form, multiple actions
> 
> 
> Chaudhary,
> 
> You need a custom validation key for each step in the process.
> Override the form's validate() and create a key. Then you should
> modify your validation.xml to run validations just for that step.
> 
> Paul
> 
> --- "Chaudhary, Harsh" <[EMAIL PROTECTED]> wrote:
> 
> > Now that I think about it, my question is just this:
> > 
> > Is there a way to selectively validate fields in a struts form?
> > 
> > Harsh.
> > 
> > -----Original Message-----
> > From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 4:03 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Validation help: One struts form, multiple actions
> > 
> > 
> > My bad. Missed that. How is it blowing out?
> > 
> > Q
> > 
> > > -----Original Message-----
> > > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > > Sent: Monday, May 08, 2006 1:27 PM
> > > To: Struts Users Mailing List; [EMAIL PROTECTED]
> > > Subject: RE: Validation help: One struts form, multiple actions
> > > 
> > > 
> > > I intentionally used /ClientA for my form name as I said, I have one
> > > struts form but multiple actions using that same form. So while
> > > validating, I want to validate only the fields associated with a
> > > particular action e.g. for ClientA action, I want to validate only
> > > fields for ClientA and same for ClientB i.e. I want to validate only
> > > Client B fields for ClientB action. All the fields are using the
> same
> > > struts form.
> > > 
> > > That is why I am using a ValidatorActionForm instead of a 
> > > ValidatorForm.
> > > 
> > > Harsh.
> > > 
> > > -----Original Message-----
> > > From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> > > Sent: Monday, May 08, 2006 3:26 PM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: Validation help: One struts form, multiple actions
> > > 
> > > 
> > > Your form name in validation.xml should be "InputDataForm" (no
> leading
> > > slash),
> > > not "/ClientA".
> > > 
> > > > -----Original Message-----
> > > > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > > > Sent: Monday, May 08, 2006 1:16 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Validation help: One struts form, multiple actions
> > > > 
> > > > 
> > > > Hi,
> > > > I am having some trouble with struts validation. Here's the case:
> > > > 
> > > > I have multiple actions corresponding to multiple pages.
> > > > I have only one struts form for all these actions.
> > > > 
> > > > I would appreciate it if someone could tell me how to set up my
> > > > validation. I am using ValidatorActionForm for my struts 
> > > > form. My action
> > > > class extends from Action.
> > > > 
> > > > Here's a snippet of my struts-config.xml:
> > > > 
> > > >                 <action path="/ClientA" 
> > > >         
> > > > type="xxx.xxx.presentation.struts.action.ClientaAction" 
> > > >                         name="InputDataForm"  
> > > >                         scope="request" 
> > > >                         validate="true"
> > > >                         input=".app.clienta">
> > > > 
> > > >                 </action>
> > > > 
> > > >                 <action path="/ClientB" 
> > > >         
> > > > type="xxx.xxx.presentation.struts.action.ClientbAction" 
> > > //This is diff
> > > > from "/ClientA" type
> > > >                         name="InputDataForm"  
> > > >                         scope="request" 
> > > >                         validate="true"
> > > >                         input=".app.clientb">
> > > > 
> > > >                 </action>
> > > > 
> > > > Snippet from my validation.xml:
> > > > 
> > > >     <formset>
> > > >     <form name="/ClientA">
> > > > 
> > > >       <field property="clientaFirstName" depends="required,mask">
> > > >         <msg key="lnra.clienta.clientaFirstName" name="required"/>
> > > >         <msg name="mask" key="lnra.global.nameMask"/>
> > > >         <var>
> > > >           <var-name>mask</var-name>
> > > >           <var-value>${nameMask}</var-value>
> > > >         </var>
> > > >       </field>
> > > >       </form>
> > > > 
> > > >     </formset>
> > > > 
> > > > I thought this should be straight forward, i.e., associate your
> > > > validation formName to actions and set validate to true in
> > > > struts-config.xml. But, its blowing out. Any ideas?
> > > > 
> > > > Thanks,
> > > > Harsh.
> > > > 
> > > > 
> > >
> ---------------------------------------------------------------------
> > > > 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]
> > > 
> > >
> ---------------------------------------------------------------------
> > > 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]
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> 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]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

Reply via email to