From user-return-128824-apmail-struts-user-archive=struts.apache.org@struts.apache.org Tue Jan 04 16:35:17 2005 Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 178 invoked from network); 4 Jan 2005 16:35:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 4 Jan 2005 16:35:17 -0000 Received: (qmail 74061 invoked by uid 500); 4 Jan 2005 16:30:11 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 74012 invoked by uid 500); 4 Jan 2005 16:30:11 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 73981 invoked by uid 99); 4 Jan 2005 16:30:10 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,FORGED_RCVD_HELO,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from KECGATE03.infy.com (HELO kecgate03.infosys.com) (220.227.179.21) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 04 Jan 2005 08:30:06 -0800 Received: from INDHUBBHS02.ad.infosys.com ([192.168.200.82]) by kecgate03.infosys.com with InterScan Messaging Security Suite; Tue, 04 Jan 2005 21:53:31 +0530 Received: from KVMMSG01.ad.infosys.com ([172.21.80.10]) by INDHUBBHS02.ad.infosys.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 4 Jan 2005 21:57:33 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C4F27A.4ABF9908" Subject: HOw to avoid validations for certain submit buttons on a single form? Date: Tue, 4 Jan 2005 21:57:32 +0530 Message-ID: <0E4BFAF32584E94398BFF4870F92CEE02C3676@kvmmsg01.ad.infosys.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: HOw to avoid validations for certain submit buttons on a single form? Thread-Index: AcTydhsGMjh1+8qfREKtvKgYhmMjtAAAFJ2A From: "Krishna Mohan Radhakrishnan" To: "Struts Users Mailing List" X-OriginalArrivalTime: 04 Jan 2005 16:27:33.0251 (UTC) FILETIME=[4B105530:01C4F27A] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C4F27A.4ABF9908 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all, =20 I have a jsp called Plan.jsp. The name of the ActionForm is PlanActionForm. There is a action class called PlanAction.java. From this PlanAction.java it is forwarding to Plan.jsp. =20 In the Plan.jsp there are 2 buttons and one text field. Text field name is txtboxTitle and the 2 buttons are "Add New Service Level" and "Inactivate Plan". Both are buttons of type submit. =20 When I am clicking "Add New Service Level", the PlanActionForm is being submitted to PlanAction.java. But when I am clicking the "Inactivate" button the same form is submitted to InactivatePlanAction.java. =20 =20 =20 InactivatePlanAction.java is like this =20 public class InactivatePlanAction extends ValidationAction {=20 =20 public InactivatePlanAction() { super(); super.setFormBean(new PlanActionForm()); super.setFormName("PlanActionForm"); } protected void doCustomValidation(ActionForm form, SessionState state) { =20 PlanActionForm planForm =3D (PlanActionForm) form; super.addError("Error happened"); =20 } =20 protected ActionForward doExecute(ActionMapping mapping, ActionForm form, SessionState state) { PlanActionForm planForm =3D (PlanActionForm) form; String forwardTo =3D "success"; return mapping.findForward(forwardTo); } } =20 The validator-rules.xml will look like this.
maxlength 64 =20
=20 Struts-config.xml will look like this =20 =20 =20 =20 Here there is a text field validation for maximum length. What I want is that when I am clicking the Inactivate button, it should not do any form validations that is given in the validator-rules.xml. It should directly go to the InactivatePlanAction.java and display the error message "Error happened". =20 But when I am clicking the "Add New Service Level" button the form has to be validated according to that given in the validator-rules.xml. =20 Now what is happening is when I am clicking the Inactivate button, it is doing the form validations too. =20 Does any body have any idea how to do it? =20 I think one solution is to put Inactivate in another ActionForm. =20 But can I achieve the result in a single Actionform. =20 Regards, Krishna Mohan=20 ------_=_NextPart_001_01C4F27A.4ABF9908--