You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by xianwinwin <xi...@gmail.com> on 2008/01/02 19:07:03 UTC

how to avoid form's validation if the user choose cancel?

I have a login form. it has 3 buttons:

1. login
2. register
3. cancel

when the user clicks the login - the application validates that the user
input data on the 'username' and 'password' fields.

Question: how can I avoid this validation if the user clicks either
'register' or 'cancel' 

thanks
-- 
View this message in context: http://www.nabble.com/how-to-avoid-form%27s-validation-if-the-user-choose-cancel--tp14582809p14582809.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: how to avoid form's validation if the user choose cancel?

Posted by Juanjo Cuadrado <jj...@gmail.com>.
And in the version 1.x?

2008/1/3, xianwinwin <xi...@gmail.com>:
>
>
> YES! exactly what I needed. thanks!!!
>
>
>
>
>
> Alberto A. Flores wrote:
> >
> > one way I did that was by using the "non-validating" method point to a
> > method (in the Action class) to have the following annotation
> >
> > @SkipValidation
> >
> > Then in the struts tag, you force the button to use such method (method
> > attribute in tag).
> >
> > Good luck!
> >
> > xianwinwin wrote:
> >> I have a login form. it has 3 buttons:
> >>
> >> 1. login
> >> 2. register
> >> 3. cancel
> >>
> >> when the user clicks the login - the application validates that the
> user
> >> input data on the 'username' and 'password' fields.
> >>
> >> Question: how can I avoid this validation if the user clicks either
> >> 'register' or 'cancel'
> >>
> >> I'm using struts2:
> >>
> >> this is the code:
> >>
> >> <s:form action="UserLogin" validate="true">
> >>     <s:textfield key="username" />
> >>     <s:password key="password" showPassword="true"/>
> >>     <!-- <s:textfield key="now" /> -->
> >>
> >>     <s:submit action="UserLogin_login" key="button.login" />
> >>     <s:submit action="UserLogin_register" key="button.confirm"
> >> onclick="form.onsubmit=null"/>
> >>     <s:submit action="UserLogin_cancel" key="button.cancel"
> >> onclick="form.onsubmit=null"/>
> >>
> >> </s:form>
> >> thanks
> >
> > --
> >
> > Alberto A. Flores
> > http://www.linkedin.com/in/aflores
> >
> >
> >
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
>
> --
> View this message in context:
> http://www.nabble.com/how-to-avoid-form%27s-validation-if-the-user-choose-cancel--tp14582809p14604337.html
>
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: how to avoid form's validation if the user choose cancel?

Posted by xianwinwin <xi...@gmail.com>.
YES! exactly what I needed. thanks!!!




Alberto A. Flores wrote:
> 
> one way I did that was by using the "non-validating" method point to a 
> method (in the Action class) to have the following annotation
> 
> @SkipValidation
> 
> Then in the struts tag, you force the button to use such method (method 
> attribute in tag).
> 
> Good luck!
> 
> xianwinwin wrote:
>> I have a login form. it has 3 buttons:
>> 
>> 1. login
>> 2. register
>> 3. cancel
>> 
>> when the user clicks the login - the application validates that the user
>> input data on the 'username' and 'password' fields.
>> 
>> Question: how can I avoid this validation if the user clicks either
>> 'register' or 'cancel' 
>> 
>> I'm using struts2:
>> 
>> this is the code:
>> 
>> <s:form action="UserLogin" validate="true">
>>     <s:textfield key="username" />
>>     <s:password key="password" showPassword="true"/>
>>     <!-- <s:textfield key="now" /> -->
>>         
>>     <s:submit action="UserLogin_login" key="button.login" />
>>     <s:submit action="UserLogin_register" key="button.confirm"
>> onclick="form.onsubmit=null"/>
>>     <s:submit action="UserLogin_cancel" key="button.cancel"
>> onclick="form.onsubmit=null"/>
>>    
>> </s:form>
>> thanks
> 
> -- 
> 
> Alberto A. Flores
> http://www.linkedin.com/in/aflores
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

-- 
View this message in context: http://www.nabble.com/how-to-avoid-form%27s-validation-if-the-user-choose-cancel--tp14582809p14604337.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: how to avoid form's validation if the user choose cancel?

Posted by "Alberto A. Flores" <aa...@gmail.com>.
one way I did that was by using the "non-validating" method point to a 
method (in the Action class) to have the following annotation

@SkipValidation

Then in the struts tag, you force the button to use such method (method 
attribute in tag).

Good luck!

xianwinwin wrote:
> I have a login form. it has 3 buttons:
> 
> 1. login
> 2. register
> 3. cancel
> 
> when the user clicks the login - the application validates that the user
> input data on the 'username' and 'password' fields.
> 
> Question: how can I avoid this validation if the user clicks either
> 'register' or 'cancel' 
> 
> I'm using struts2:
> 
> this is the code:
> 
> <s:form action="UserLogin" validate="true">
>     <s:textfield key="username" />
>     <s:password key="password" showPassword="true"/>
>     <!-- <s:textfield key="now" /> -->
>         
>     <s:submit action="UserLogin_login" key="button.login" />
>     <s:submit action="UserLogin_register" key="button.confirm"
> onclick="form.onsubmit=null"/>
>     <s:submit action="UserLogin_cancel" key="button.cancel"
> onclick="form.onsubmit=null"/>
>    
> </s:form>
> thanks

-- 

Alberto A. Flores
http://www.linkedin.com/in/aflores



RE: how to avoid form's validation if the user choose cancel?

Posted by Martin Gainty <mg...@hotmail.com>.
the easiest way is to configure login/(cancel)logout/register to separate actionsA complete example is located at
http://struts.apache.org/2.x/docs/simplelogin-with-session.html
ThanksMartin______________________________________________Disclaimer and confidentiality noteEverything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> > > I have a login form. it has 3 buttons:> > 1. login> 2. register> 3. cancel> > when the user clicks the login - the application validates that the user> input data on the 'username' and 'password' fields.> > Question: how can I avoid this validation if the user clicks either> 'register' or 'cancel' > > I'm using struts2:> > this is the code:> > <s:form action="UserLogin" validate="true">> <s:textfield key="username" />> <s:password key="password" showPassword="true"/>> <!-- <s:textfield key="now" /> -->> > <s:submit action="UserLogin_login" key="button.login" />> <s:submit action="UserLogin_register" key="button.confirm"> onclick="form.onsubmit=null"/>> <s:submit action="UserLogin_cancel" key="button.cancel"> onclick="form.onsubmit=null"/>> > </s:form>> thanks> -- > View this message in context: http://www.nabble.com/how-to-avoid-form%27s-validation-if-the-user-choose-cancel--tp14582809p14582809.html> Sent from the Struts - User mailing list archive at Nabble.com.> > > ---------------------------------------------------------------------> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org> For additional commands, e-mail: user-help@struts.apache.org> 
_________________________________________________________________
Get the power of Windows + Web with the new Windows Live.
http://www.windowslive.com?ocid=TXT_TAGHM_Wave2_powerofwindows_122007