struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Givler, Eric" <egiv...@state.pa.us>
Subject RE: Action based client validation
Date Wed, 06 Sep 2006 15:55:44 GMT
Assuming you've turned off the automatic validation (validate="false" in struts-config.xml),
then you can programmatically determine which button was pressed in your execute() method,
via request.getParameter("btn_cancel") for example, then decide not to call something.

public ActionForward execute (...) {
   if ( request.getParameter("btn_cancel") == null ) {
      // didn't press [Cancel]
      ActionMessages errors = form.validate(mapping,request);
      if ( ! errors.isEmpty() ) {
         saveErrors(request, errors);
   ...

Also, if using javascript, you can turn-off validation when the cancel button is pressed by
setting bCancel=true (I think).

Good luck.

-----Original Message-----
From: Vaylee Mckenzie-Daniels (VA) [mailto:MckenzVA@telkom.co.za]
Sent: Wednesday, September 06, 2006 9:02 AM
To: user@struts.apache.org
Subject: RE: Action based client validation





> I am struggling to find resources on how to enable the validation
> only when submit is selected. Validation should not be done when
> cancel is selected.
>

> Please help.
>

> Thx
> Vaylee


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This e-mail and its contents are subject to the Telkom SA Limited
e-mail legal notice available at

http://www.telkom.co.za/TelkomEMailLegalNotice.PDF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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


Mime
View raw message