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
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Confirmation Script not working correctly

    Hello,

    I have a confirmation script that I am using with a php page which asks the user if they are sure if the order is correct and to continue to process or go back and change it. Here is the script:

    Code:
    <script type="text/javascript">
    <!--
    // Confirmation of order before values are passed to the database
    // onclick event
    
    function confirmation() {
    	var answer = confirm("Are you sure your order is correct?")
    	if (answer){
    		alert("Click OK to Continue")
    		window.location = "menu.php";
    	}
    	else{
    		alert("Please click OK to change your order.")
    	}
    }
    //-->
    </script>
    As I'm sure the guru's see it immediately this newbie is not sure why it continues to process the script when the cancel is selected. I just want it to stay on the page and let them change their selections.

    Any help is appreciated. Thanks in advance.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,732
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Quote Originally Posted by SuzyQueue View Post
    Hello,

    I have a confirmation script that I am using with a php page which asks the user if they are sure if the order is correct and to continue to process or go back and change it. Here is the script:

    Code:
    <script type="text/javascript">
    <!--
    // Confirmation of order before values are passed to the database
    // onclick event
    
    function confirmation() {
    	var answer = confirm("Are you sure your order is correct?")
    	if (answer){
    		alert("Click OK to Continue")
    		window.location = "menu.php";
    	}
    	else{
    		alert("Please click OK to change your order.")
    	}
    }
    //-->
    </script>
    As I'm sure the guru's see it immediately this newbie is not sure why it continues to process the script when the cancel is selected. I just want it to stay on the page and let them change their selections.

    Any help is appreciated. Thanks in advance.
    Code:
    else{
    alert ("Please click OK to change your order.");
    return false;
    }

  • Users who have thanked Philip M for this post:

    SuzyQueue (08-02-2008)

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you. I have my preferences set to receive emails for any replies but never got notice. Sorry for being late on replying. All your input and help is very much appreciated. I really don't know what I would do without these forums and the nice people who care enough to reply.

    Thanks again!


  •  

    Posting Permissions

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