Categories | Question details Back To List | ||
Can a dhtmlxwindow be simulated as a javascript confirm box? I am working on an implementation using dhtmlxwindows. I intend to simulate a javascript confirm box with a custom message and custom OK/Cancel buttons. I have a function which takes in a message as an input parameter say for example openWindow(message). I then initialize a dhtmlxwindow with an attached div which contains the aforementioned message & custom buttons. I also have written 2 event listeners for the OK and Cancel buttons which close the dhx window using the hide(). I see the window open up fine and close if OK or Cancel are pressed. However, I also want to return a true if OK is clicked and false if Cancel is clicked. so that I can invoke it as function doSomething() { var value = openWindow("Are you sure?"); if (value == true) // do something else else return; } Can you assist me? Thanks, Rahul Kulkarni Answer posted by Support on Dec 24, 2008 01:28 dhtmlxWindow can not stop script like default confirm/alert message. You can use it like this: <script> var w1 = dhxWins.createWindow("confirm", 10, 10, 420, 100); w1.attachObject("confirmWindowContent"); w1.hide(); function askUser() { w1.show(); w1.setModal(true); } function doOnOK { // user pressed ok button } function doOnCancel() { // user pressed cancel button } </script> <body> <div id="confirmWindowContent"...> confirmation text <input type="button" value="Ok" onclick="doOnOK"> <input type="button" value="Cancel" onclick="doOnCancel"> </div> |