To display a popup confirmation request as a javascript confirm, call the function confirm(). Calling the function will popup a javascript dialog box with OK and Cancel buttons. Pressing OK the browser will be redirected to a page with the same url of the previous page with 'confirm' GET parameter set to Y. Pressing Cancel 'confirm' GET parameter will be set to N.
Here is an example showing how the function can be used. The confirmation, in this example, is shown when a delobj GET parameter is found.
if ($_GET["delobj"]) { //first time here: ask for confirm
$_obweb->confirm(_l("Are you sure?"));
}
if ($_GET["delobj"] AND $_GET["confirm"]=="Y") {
//second time and user confirmed: do your actions
}
if ($_GET["delobj"] AND $_GET["confirm"]) {
//after second time user confirmed or refused
$url =& new url(); //creates an url object
$url->dropVals(array("confirm", "delobj")); //removes params from url
$url->reload(); //reloads the page
}