Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Stop Method

  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Stop Method

    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?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think what you can do is this.

    When you submit the form have it call a javascript function. Then if the the form fits all of the criteria then return true; and if not the return false;

    If it returns false; then the form will not submit.

    cheers
    I try to convince 'em that I am computer geek, but I just can't do it. Why? Oh why?

  • #3
    Regular Coder
    Join Date
    Sep 2005
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ....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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •