Re: HOw to avoid validations for certain submit buttons on a single form?
Hi, Could I ask where to set the bCancel ? as a parameter in the request ?? Thx a lot. Cliff - Original Message - From: "Hubert Rabago" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Wednesday, January 05, 2005 2:27 AM Subject: Re: HOw to avoid validations for certain submit buttons on a single form? > Like Jim said, take a look at the validate=false attribute for the > /InactivatePlanAction. Also, the javascript validation will kick in > by default. You can add an onClick handler to the "Inactivate" button > to set "bCancel=true;" so the javascript validation is skipped. > > Hubert > > On Tue, 4 Jan 2005 10:19:06 -0700, Jim Barrows <[EMAIL PROTECTED]> wrote: > > > -Original Message- > > > From: Krishna Mohan Radhakrishnan [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, January 04, 2005 9:28 AM > > > To: Struts Users Mailing List > > > Subject: HOw to avoid validations for certain submit buttons > > > on a single > > > form? > > > > > > But can I achieve the result in a single Actionform. > > > > Yes. > > Read the validation and struts-config documentation and DTD's for further details. Something about validate being false. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HOw to avoid validations for certain submit buttons on a single form?
Hi, You may get the reference from the Cancel Button in CancelTag. The Tag will set a parameter in the request to block the validation in the servlet. Good Luck Cliff - Original Message - From: "Krishna Mohan Radhakrishnan" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Wednesday, January 05, 2005 12:27 AM Subject: HOw to avoid validations for certain submit buttons on a single form? Hi all, 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. 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. 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. InactivatePlanAction.java is like this public class InactivatePlanAction extends ValidationAction { public InactivatePlanAction() { super(); super.setFormBean(new PlanActionForm()); super.setFormName("PlanActionForm"); } protected void doCustomValidation(ActionForm form, SessionState state) { PlanActionForm planForm = (PlanActionForm) form; super.addError("Error happened"); } protected ActionForward doExecute(ActionMapping mapping, ActionForm form, SessionState state) { PlanActionForm planForm = (PlanActionForm) form; String forwardTo = "success"; return mapping.findForward(forwardTo); } } The validator-rules.xml will look like this. maxlength 64 Struts-config.xml will look like this 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". 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. Now what is happening is when I am clicking the Inactivate button, it is doing the form validations too. Does any body have any idea how to do it? I think one solution is to put Inactivate in another ActionForm. But can I achieve the result in a single Actionform. Regards, Krishna Mohan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HOw to avoid validations for certain submit buttons on a single form?
Like Jim said, take a look at the validate=false attribute for the /InactivatePlanAction. Also, the javascript validation will kick in by default. You can add an onClick handler to the "Inactivate" button to set "bCancel=true;" so the javascript validation is skipped. Hubert On Tue, 4 Jan 2005 10:19:06 -0700, Jim Barrows <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: Krishna Mohan Radhakrishnan [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, January 04, 2005 9:28 AM > > To: Struts Users Mailing List > > Subject: HOw to avoid validations for certain submit buttons > > on a single > > form? > > > > But can I achieve the result in a single Actionform. > > Yes. > Read the validation and struts-config documentation and DTD's for further > details. Something about validate being false. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HOw to avoid validations for certain submit buttons on a single form?
> -Original Message- > From: Krishna Mohan Radhakrishnan [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 04, 2005 9:28 AM > To: Struts Users Mailing List > Subject: HOw to avoid validations for certain submit buttons > on a single > form? > > I think one solution is to put Inactivate in another ActionForm. > > > > But can I achieve the result in a single Actionform. Yes. Read the validation and struts-config documentation and DTD's for further details. Something about validate being false. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HOw to avoid validations for certain submit buttons on a single form?
Hi all, 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. 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. 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. InactivatePlanAction.java is like this public class InactivatePlanAction extends ValidationAction { public InactivatePlanAction() { super(); super.setFormBean(new PlanActionForm()); super.setFormName("PlanActionForm"); } protected void doCustomValidation(ActionForm form, SessionState state) { PlanActionForm planForm = (PlanActionForm) form; super.addError("Error happened"); } protected ActionForward doExecute(ActionMapping mapping, ActionForm form, SessionState state) { PlanActionForm planForm = (PlanActionForm) form; String forwardTo = "success"; return mapping.findForward(forwardTo); } } The validator-rules.xml will look like this. maxlength 64 Struts-config.xml will look like this 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". 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. Now what is happening is when I am clicking the Inactivate button, it is doing the form validations too. Does any body have any idea how to do it? I think one solution is to put Inactivate in another ActionForm. But can I achieve the result in a single Actionform. Regards, Krishna Mohan