Thanks for your input bmf5 and Hubert. For those interested, here are some code snippets that worked for me:
<html:form action="/gradeLevel" onsubmit="return validateMe(this);"> ... <input type="image" src="/images/btn_primary_action_save.gif" align="right" onmouseover="src='/images/btn_primary_action_save_roll.gif'" onmouseout="src='/images/btn_primary_action_save.gif'"/> ... <html:javascript formName = "myForm"/> <SCRIPT LANGUAGE="JavaScript"> <!-- function validateMe(thisForm) { if (validateMyForm(thisForm)) { document.forms[0].Dispatch.value='Save'; document.forms[0].submit(); } else { return false; } } --> </SCRIPT> The above code allowed for both client and server-side validation, when client-side validation failed the form did not get submitted, allowed images for submit button, and allowed "enter" key to submit the form. Brian Barnett -----Original Message----- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 3:59 PM To: Struts Users Mailing List Subject: Re: Validation problem - form still submits after client-side validat ion fails. I could be wrong, and i don't have the time to verify this with code right now, but it's possible that the reason the form still gets submitted is because you're calling form.submit() directly. That might be bypassing the onsubmit="return validateMyForm(this)". You *do* have that, right? I don't know how to do what you're trying to do with image buttons, though. For that, you'll probably want Mike McGrady's opinion since he works with image buttons a lot. Do you have to call submit() explicitly? Hubert On Mon, 20 Sep 2004 15:51:55 -0500, Barnett, Brian W. <[EMAIL PROTECTED]> wrote: > Both the client-side and the server-side validation are executing instead of > just the client-side. I know it has something to do with the way I've coded > the save button. The underlying problem is that I want to use images and > roll-over images for the save button but I also want the "enter" key to > submit the form. > > Here is the save button code in the jsp: > > <input type="image" > onclick="document.forms[0].Dispatch.value='Save';document.forms[0].submit(); > " src="/images/btn_primary_action_save.gif" align="right" > onmouseover="src='/images/btn_primary_action_save_roll.gif'" > onmouseout="src='/images/btn_primary_action_save.gif'"/> > > The roll-over images works, and the "enter" key works but it looks like the > form still gets submitted after client-side validation fails. Does anyone > know how to prevent that and still maintain images and "enter" key > functionality? > > Thanks, > > Brian Barnett > > --------------------------------------------------------------------- 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]