You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ciaran Hanley <ci...@sentenial.ie> on 2004/06/15 16:44:48 UTC

Form Validation Before Submit

Hello,

 

I have a simple form in my application which I am having trouble with.

 

On entering the action class and forwarding to the JSP I see error messages
which should only appear when the form has been validated after submitting.
I cannot figure out why this is appearing as all that is called inside the
action class is a mapping.findForward() to the page in question. Can anybody
suggest any possible reasons as to why I am seeing the form error messages
before submitting.

 

Thanks,

CH


RE: Form Validation Before Submit

Posted by Ciaran Hanley <ci...@sentenial.ie>.
This is not the case with my struts config, I have other forms which are
much more complex which work fine in the app yet this much simpler one
attempts to validate before any data is even entered yet I cannot figure it
out.

Ciaran

-----Original Message-----
From: ksitron [mailto:ksitron@elp.rr.com] 
Sent: 15 June 2004 17:02
To: Struts Users Mailing List
Subject: Re: Form Validation Before Submit



In your struts-config.xml, if you have the validate="true" set. Then, 
the validate method of your form will be
called before your action.execute method is called.

Ciaran Hanley wrote:

>Hello,
>
> 
>
>I have a simple form in my application which I am having trouble with.
>
> 
>
>On entering the action class and forwarding to the JSP I see error messages
>which should only appear when the form has been validated after submitting.
>I cannot figure out why this is appearing as all that is called inside the
>action class is a mapping.findForward() to the page in question. Can
anybody
>suggest any possible reasons as to why I am seeing the form error messages
>before submitting.
>
> 
>
>Thanks,
>
>CH
>
>
>  
>

-- 

Kevin J Citron
Sr. Object Imagineer
Optimized Objects, Inc.
EL Paso, Texas 79930
(915) 565-7785/566-2403



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



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


Re: Form Validation Before Submit

Posted by ksitron <ks...@elp.rr.com>.

In your struts-config.xml, if you have the validate="true" set. Then, 
the validate method of your form will be
called before your action.execute method is called.

Ciaran Hanley wrote:

>Hello,
>
> 
>
>I have a simple form in my application which I am having trouble with.
>
> 
>
>On entering the action class and forwarding to the JSP I see error messages
>which should only appear when the form has been validated after submitting.
>I cannot figure out why this is appearing as all that is called inside the
>action class is a mapping.findForward() to the page in question. Can anybody
>suggest any possible reasons as to why I am seeing the form error messages
>before submitting.
>
> 
>
>Thanks,
>
>CH
>
>
>  
>

-- 

Kevin J Citron
Sr. Object Imagineer
Optimized Objects, Inc.
EL Paso, Texas 79930
(915) 565-7785/566-2403



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


Re: Form Validation Before Submit

Posted by Lionel <co...@free.fr>.
Ciaran Hanley wrote:
> Hello,
>
>
>
> I have a simple form in my application which I am having trouble with.
>
>
>
> On entering the action class and forwarding to the JSP I see error
> messages which should only appear when the form has been validated
> after submitting.

do you check that the form "is beeing submitted" ?
struts calls first the validate method even if the form hasn't been submited
(initialisation)
You have to return null in the validate method if not in "submit" mode.




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