Topic: is there any way to abort php execution using confirmCommans ?

I was recently trying to use confirmCommands to avoid execution os php code....but it just skip $oResponse commands no any other php code. 

Is it possible to have something like this:

function delete($table,$id)
{
    $oResponse= new xajaxResponse();

   if($oResponse->confirmCommands....)
        do this php code.....
   else
       return $oResponse;
    .
    .

    return $oResponse;


}

thx in advance.

Re: is there any way to abort php execution using confirmCommans ?

$oResponse->confirmCommands

Do you mean, that the client has to confirm something that triggers the further processing of the php function? If so, that's not possible. We cannot 'read' any client values during the execution of the php script. That's the way how async requests work.

Re: is there any way to abort php execution using confirmCommans ?

oh...so then the only possible way to achieve it would be?:

...onclick="if(!confirm('do you really want to delete it?')) return false; xajax.myfunction....... "

Re: is there any way to abort php execution using confirmCommans ?

yep, that's correct.

Re: is there any way to abort php execution using confirmCommans ?

Try something like this:

function delete($table, $id, $confirmation = false)
{
    $oResponse= new xajaxResponse();

    php_code...

    if ($confirmation != true)
    {
        $oResponse->confirmCommands(1, "....");
        $oResponse->call("xajax_delete", $table, $id, true);
        return $oResponse;
    }

    do the rest...

}

6 (edited by ludo110183 2008-12-03 6:06:03 PM)

Re: is there any way to abort php execution using confirmCommans ?

What a suggestion. Recursion!, never thought of that!. It works!

Thx!