Link to home
Start Free TrialLog in
Avatar of TecServ
TecServFlag for United States of America

asked on

Cancel post-back on submit button click

I am unable to cancel the post-back in IE7 using return false. It cancels in FireFox but not in IE.
<input type="submit" name="btnEditCancel_0" value="Cancel" id="btnEditCancel_0" onClick="return false;" />
<input type="submit" name="btnEditCancel_0" value="Cancel" id="btnEditCancel_0" onClick="javascript:return false;" />

Open in new window

Avatar of b0lsc0tt
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Of course your form tag needs the other attributes which make it valid and work.  That was just as an example. :)

Let me know if you have a question.

Avatar of TecServ


I do need the form to submit at some point so I can't hard-code that the form never submits. I've never tried to change the onsubmit attribute of a form with script so I tested that out. The script changed it but, it wouldn't obey the new value (at least in IE where I'm having my issue).
Let me see the script and other code then if you'd like help.  IE will support what I suggested but it sounds like you actually may need something else.  If I misunderstood your question or it has changed a bit then let me know.  I really have very little info and not even a real question.  You have to provide both if you want help.

Forced accept.

EE Admin