How to use dhtmlx.confirm ?

Hello,
I’m currently using the native javascript confirm function. But I’d like to use dhtmlx.confirm or message instead.

example :

[code]if (confirm(“continue?”) {
// True
// Proceed the other scripts
} else {
return false;

}[/code]

When I try to use dhtml.confirm instead, it doesn’t work. It only displays the confirm message but there is no true/false value returned.

if (dhtmlx.confirm("continue?") { // True // Proceed the other scripts } else { return false; }

I tried with dhtmlx.message with the same result.

How am I supposed to do ?

Thanks

js code can’t really block execution flow, so you can’t use js confirm in the same way as native confirm. Valid code will look as

dhtmlx.confirm({ text":"continue?", callback:function(result){ if (result) proceed_the_other_script(); } });

Thank you !

I know this is an old thread, anyway… a wrapper functions works nicely:

var app = { } // use your own namespace

app.confirm = function(m, cb) {
	dhtmlx.message({
        type:"confirm",
        text: m,
        callback: function(r){ if (r) cb() }
    });	
}

Then call it:

app.confirm("Sure you want to do this?",  function(){
  // Ok logic here
  alert('Ok was pushed')
 })