You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Justin F. Knotzke" <jk...@shampoo.ca> on 2003/02/21 04:27:16 UTC

Form Validation


   Hi,

   I'd like to know if future versions of struts will have the ability
to return the form, with it's contents back to the input page after
failing a validate. 

   If I am going about it correctly, after performing a validate(), and
upon returning with ActionErrors, the form is returned empty to the input
page.

   The obvious 'workaround' is to put the form back into the request.

   But it would be nice if one didn't have to do this.

   It would also be nice if struts had a property which you could set
(say inside the taglib) to tell validate() to not actually validate,
depending on the submit (ie, the user hit "cancel" no need to validate..

   Or is this already possible without having to code it by hand?

   Thanks

   Justin.
    
-- 
Justin F. Knotzke
jknotzke@shampoo.ca
http://www.shampoo.ca

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Form Validation

Posted by "Justin F. Knotzke" <jk...@shampoo.ca>.
On Thu, Feb 20, 2003 at 10:29:51PM -0500, Ian Hunter wrote:
> It seems to work "right" for me.

   That's nice.

   Are you saying that after validating a form and upon returning to the
input page your form has the data the user entered, without adding any
special code (as in manually adding the form to the request)?
 
   J.

-- 
Justin F. Knotzke
jknotzke@shampoo.ca
http://www.shampoo.ca

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Form Validation

Posted by Ian Hunter <ih...@hunterweb.net>.
It seems to work "right" for me.

----- Original Message ----- 
From: "Justin F. Knotzke" <jk...@shampoo.ca>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, February 20, 2003 10:27 PM
Subject: Form Validation


> 
> 
>    Hi,
> 
>    I'd like to know if future versions of struts will have the ability
> to return the form, with it's contents back to the input page after
> failing a validate. 
> 
>    If I am going about it correctly, after performing a validate(), and
> upon returning with ActionErrors, the form is returned empty to the input
> page.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Form Validation

Posted by Joseph Fifield <jf...@programmerplanet.org>.
if (this.isCancelled(request)) {
  return mapping.findForward("cancel");
}

Joe

> -----Original Message-----
> From: Geeta Ramani [mailto:geeta.ramani@cmpco.com] 
> Sent: Friday, February 21, 2003 9:06 AM
> To: Struts Users Mailing List
> Subject: Re: Form Validation
> 
> 
> Justin:
> 
> There is a html:cancel tag that you can use in your jsp which 
> (according to the docs) will indeed bypass the validate 
> method in the form bean and go directly to the action. In 
> your perform/execute method all you need to do is say something like:
> 
> if 
> (request.getParameter("org.apache.struts.taglib.html.CANCEL") 
> != null) {
>             return mapping.findForward("cancel");
> }
> 
> Btw, I am working with Struts 1.02, maybe there's an even 
> slicker solution with 1.1..:)
> 
> regards,
> Geeta
> 
> "Justin F. Knotzke" wrote:
> 
> >    Hi,
> >
> >    I'd like to know if future versions of struts will have 
> the ability 
> > to return the form, with it's contents back to the input page after 
> > failing a validate.
> >
> >    If I am going about it correctly, after performing a validate(), 
> > and upon returning with ActionErrors, the form is returned empty to 
> > the input page.
> >
> >    The obvious 'workaround' is to put the form back into 
> the request.
> >
> >    But it would be nice if one didn't have to do this.
> >
> >    It would also be nice if struts had a property which you 
> could set 
> > (say inside the taglib) to tell validate() to not actually 
> validate, 
> > depending on the submit (ie, the user hit "cancel" no need to 
> > validate..
> >
> >    Or is this already possible without having to code it by hand?
> >
> >    Thanks
> >
> >    Justin.
> >
> > --
> > Justin F. Knotzke
> > jknotzke@shampoo.ca
> > http://www.shampoo.ca
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Form Validation

Posted by Geeta Ramani <ge...@cmpco.com>.
Justin:

There is a html:cancel tag that you can use in your jsp which (according to
the docs) will indeed bypass the validate method in the form bean and go
directly to the action. In your perform/execute method all you need to do is
say something like:

if (request.getParameter("org.apache.struts.taglib.html.CANCEL") != null) {
            return mapping.findForward("cancel");
}

Btw, I am working with Struts 1.02, maybe there's an even slicker solution
with 1.1..:)

regards,
Geeta

"Justin F. Knotzke" wrote:

>    Hi,
>
>    I'd like to know if future versions of struts will have the ability
> to return the form, with it's contents back to the input page after
> failing a validate.
>
>    If I am going about it correctly, after performing a validate(), and
> upon returning with ActionErrors, the form is returned empty to the input
> page.
>
>    The obvious 'workaround' is to put the form back into the request.
>
>    But it would be nice if one didn't have to do this.
>
>    It would also be nice if struts had a property which you could set
> (say inside the taglib) to tell validate() to not actually validate,
> depending on the submit (ie, the user hit "cancel" no need to validate..
>
>    Or is this already possible without having to code it by hand?
>
>    Thanks
>
>    Justin.
>
> --
> Justin F. Knotzke
> jknotzke@shampoo.ca
> http://www.shampoo.ca
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org