Skip to main content
Jush1
Known Participant
February 2, 2010
Question

Confirm OK/Cancel: could not stop processing after redirect

  • February 2, 2010
  • 1 reply
  • 907 views

I am have a problem doing a JavaScript confirmation which in a cfinclude file in the process page.

When the display page send content to the process page, and process page first do some validation which is included in a cfinclude file. The issue is user need to choose from a confirmation message box, choose OK to continue processing, Cancel to send user to previous display page. Every thing seems working, except when user choose Cancel and is sent to the previous page, the execution on the process page continues anyway, behind scene though. Without server process validation you may not realize it. but the truth is it does not stop when user choose Cancel.

So I need your insights how to handle the situation: give user choice to choose but when user select Cancel, stop the execution of the code after cfinclude.

Is there anyway to do the message box without JavaScript? If only it could be done in Coldfusion, then the problem solve, by setting a coldfusion variable to stop the execution.

Please help!

Thanks

Jush

    This topic has been closed for replies.

    1 reply

    Inspiring
    February 2, 2010

    Keep in mind that cf runs on the server, js runs on the client, and the two don't know what the other is doing.  You have a couple of choices.

    1.  Put the validation on the initial page so that selecting cancel keeps them on that page.

    2. Have a page that does validation and nothing else.  Have the rest of the code on another page.  Use js to send the user to the proper page depending on what they select with the confirm dialogue.

    Jush1
    Jush1Author
    Known Participant
    February 2, 2010

    Thanks Dan, I guess I should not mix client validation and processing code on the same page. Appreciate your help.