Search code examples
asp-classicreturnconfirm

Confirm box return false won't work on server side?


I have a checking on my ASP server side, but when I have the following code. I can't get the return false to work? Can anyone kindly give me a helping hand

if Ubound(arr) < 0 then
        response.write "<script language='javascript'>"
        response.write "if (confirm(""Emptying the selected box will delete the Holiday Calendar Code"")==0)"
        response.write " {return false;}"
        response.write "</script>"
    end if

Solution

  • to get the confirm box to return false, try this:

    if Ubound(arr) < 0 then
            response.write "<script language='javascript'>"
            response.write "if ( ! confirm(""Emptying the selected box will delete the Holiday Calendar Code"") )"
            response.write " {return false;}"
            response.write "</script>"
        end if
    

    however, it will not stop any loading of the page. Server side code always executes before any client side code, so adding a confirm box will not work here as you intend it to. what exactly are you trying to accomplish?

    The results: Still error on the return statements