struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alberto A. Flores" <aaflo...@gmail.com>
Subject Re: how to avoid form's validation if the user choose cancel?
Date Wed, 02 Jan 2008 18:39:01 GMT
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



Mime
View raw message