-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andrew,
Andrew Martin wrote: > I have just begun to add validation to my forms using struts > validator, which is quite nice. I have however a problem when I have > more than one submit button on a form. > > For example I have a Save button and a Back button. The Back button > is also a submit (instead of a standard button - basically because we > are creating a JS free applciation!) > > Within the struts configuration the validate is set to true for this > action with an input page defined. The validation is set to check > certain fields are not empty. What you want to do is to set your back button to be a "cancel" button. This is done differently depending on which content-builder you are using (JSP, Velocity, or whatever), but basically you have to end up naming the button "org.apache.struts.taglib.html.CANCEL", which indicates to struts that validation should be skipped. (Note that struts 1.2.7 (?) and higher require you to set a property for each action mapping that indicates that the action is cancellable). Note that, even though the validation is skipped, the form bean being used for validation is *still* filled with this non-validated data. If you are using a multi-page form bean, this is ideal: the user goes BACK, changes something on the previous page, and then when they come forward, again, you can redisplay the information they already entered into the form. Once they submit *that*, you perform the validation and move on. Of course, if you want BACK, NEXT, and CANCEL buttons on the page, then you can't really use this solution. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFWckq9CaO5/Lv0PARAjU2AJsHj3tDfnajq4v6FlOm+IW3hXabkwCfUXXm HOv3KWS1mMon6Bbn32qnbCo= =iLZY -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]