struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cvu <chung...@baesystems.com>
Subject Please help, donot validate a field when cancel button is click
Date Wed, 25 Jul 2007 14:53:58 GMT

Hi Gurus, please help
Scenario:By pass the validation when cancel button is click.
  I have a start.jsp that has a text field required to be filled and 2
buttons Cancel and submit. The submit button is click I forward it to
finish.jsp but if the cancel button is click then go to welcome.jsp. Right
now if the text field is filled then it go to finished.jsp if it is not
filled then error msg will post next to it. However, when I click the Cancel
button - type button, it requires text field has to be filled but I want to
by pass the validation (why I have to fill up the field when I click the
cancel button?)

I have a validation.xml file like this:
<form name="incomingSecretDocumentForm">
<field property="sentTo" depends="required,maxlength">
    		<arg0 key="document.sent.to.field.name" />
    		<arg1 name="maxlength" key="${var:maxlength}"
    			resource="false" />
    		<var>
    			<var-name>maxlength</var-name>
    			<var-value>24</var-value>
    		</var>
</field> 
</form>

And the start.jsp like this:
<tr>
<td align="right" class="FormElementText">
<bean:message key="document.serial.number.field.name" />:
</td>
<td align="left">
<html:text property="serialNum" styleClass="FormElements"
	maxlength="10" />
<BR>
<html:errors property="serialNum" header="empty"
	prefix="errors.form.prefix" suffix="errors.form.suffix" />
</td>
</tr>
and the 2 buttons - Cancel is button type, other is Submit type like this:
<td align="center">
							
<html:button
                                  property="buttonName"
                                  styleClass="button"
                                  value="Cancel"
                                  />

<html:submit styleClass="button" property="buttonName">
	 <bean:message key="document.button.save.next"/>
</html:submit>						
									
	
</td>


Please help 
many thanks
    	
-- 
View this message in context: http://www.nabble.com/Please-help%2C-donot-validate-a-field-when-cancel-button-is-click-tf4142663.html#a11784192
Sent from the Struts - Dev mailing list archive at Nabble.com.


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


Mime
View raw message