Topic: Simple Xajax pattern for popping up a confirm command box.

Here is a method of making sure your users cannot accidentally delete things - using a standard confirm box.

function verifyRemove( $id , $verified = FALSE ){

  $aR = new xajaxResponse();

    if( $verified == TRUE ){
            $err = $this->EventsManager->delete( "id", $id ) ;

            if( $this->debug ) $aR->alert( serialize( $err ) ) ;

            $aR->call( "xajax_Events.restart" );
        return $aR;

   $aR->confirmCommands( 1 , "Completely remove this from your website?\n\nPress OK to confirm."  );
   $aR->call("xajax_Events.verifyRemove", $id, TRUE );
   return $aR;

This is part of a greater class as you can tell -  but seeing as I use this particular pattern so often I thought I'd offer it up for those not aware of it, or, anyone who can improve on it of course!

The only way to get to verifyRemove( $id, TRUE) is to have pressed OK on the confirm box.

There are those who say you should never delete things, and I have used similar in the past to copy a record to a backup table too.

Hope this helps someone. 

After 4 years of use - Xajax still rocks.