View Full Version : Stop Method
09-14-2005, 11:39 PM
I am trying to stop a page form loading based on a certain condition. I want to do this because for hte onclick for my submit button, there are two functions being executed and if a condition is satisfied in teh first I don't want the second to run. I tried window.stop(), but I get an error message that says this is not supported by the browser. Is there any type of universal stop method or way of getting around this?
09-15-2005, 12:08 AM
I think what you can do is this.
If it returns false; then the form will not submit.
09-15-2005, 01:34 PM
....to go along with that... If you have two functions (say myFunctionA and myFunctionB) and you want myFunctionB only to run if myFunctionA was successful, and if myFunctionB is also successful, submit the form, what you can do is for your submit button: onClick='return myFunctionA' where myFunctionA returns true if successful. Then in the FORM tag, onSubmit='return myFunctionB' again where true=success.
One last note: you can also specifically call myForm.submit() if you want. I used this trick just recently in code I'm working on now (which reminds me that I should relate my experiences to that thread as well...) Basically I wanted to pop up a "confirm"-like window, that also had extras like a "details" button and a textarea displaying the details. Since the original onSubmit / onClick methods would continue reguardless of how the user responded to the popup window, I ended up having the onSubmit / onClick methods return false and then have the popup-window function submit() the form if the user hit 'OK' on the popup.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.