error popup

Hi!

I am using a try-catch block for an sql query. I would like to have a popup showing the error message cauth. After closing the popup, the program should run further reulting in a redirect.


}catch(Exception $ex){

			"code for popup?"

			}

			

			

			$this->redirect(array('workflow','id'=>$model->del_oid));

I tried using CJuiDialog, but it doesnt stops the program, so the code redirects and i cant even see the error window. I tried using javascript alert, but in this case, the header is sent before the redirect and i get "Cannot modify header information - headers already sent by" error.

What is the proper way to do this? Any suggestions?

Actually with the CJuiDialog i get the same header error. So i guess my question is, how to display a popup, and after closing it, how to redirect without cousing a header error?

The redirect code should not be in the php (controller file i guess).

You need to actually render something first




}catch(Exception $ex){

  $this->render("error", array("exception" => $ex));

  return;

}



And in the error.php view (name it however you want) add a callback when closing the CJuiDialog.




close: function(event, ui){

  window.location.href = <?php echo $this->createUrl(array('workflow','id'=>$model->del_oid)); ?>

}

(Note: that code may not work but you get the idea)