Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tim Bennett on Oct 28, 2008 09:59
open dhtmlx forum
Modal window block js thread?

I have the following question. Is it possible to get a modal dhtmlx window to block the current thread until the window is closed? For example I have the following html and javascript.

HTML
---------------
<form method="post" action="DoStuff" id="formDoStuff" name="formDoStuff" onSubmit="javascript: return okayToContinue();">
<!-- Various inputs go here -->
</form>


Javascript
---------------
function okayToContinue() {
var dhxWins = new dhtmlXWindows();
dhxWins.setImagePath("../Common/dhtmlxWindows/codebase/imgs/");

var win = dhxWins.createWindow("w1", 270, 170, 350, 120);
win.setText("Delete Excess Values?");
win.setModal(true);
win.attachObject("obj");
win.button("close").disable();
win.button("park").disable();
win.button("minmax1").disable();

/******
Here I want to block the thread until the user makes a selection and then return true or false depending on their selection.
******/

}


Do you have info on how to block the thread? I can think of some workarounds, but they're a smidge messy and not at all elegant.

Thanks,

Tim.

Answer posted on Oct 29, 2008 02:37
There is no real "block thread" solution, which will work in all browsers. The only way to organize necessary logic - split code in two functions, frst one will end after creating modal window, second - will be called from onClose event of window.