I have a modal dialog using jquery UI dialog. I now want to popup another dialog when i user changes a field in the first dialog. Both should be modal.
Is this possible as i tried putting this code there and nothing seems to popup. The following code works fine when click from a regular page (where the select control with id: selectDropdownThatICanChange) but if the same select control that i am changing is itself a dialog the dialog("Open") line does nothing. The change event fires and the open method gets called but nothing pops up.
$("#secondModalDialog").dialog({
resizable: false,
height: 'auto',
autoOpen: false,
title: "Warning",
width: 400,
modal: true,
buttons: {
'Close': function () {
$("#secondModalDialog").dialog('close');
}
}
});
$('#selectDropdownThatICanChange').live("change", function () {
$("#secondModalDialog").dialog('open');
});
and here is the dialog (which is just a div)
<div id="secondModalDialog" style="display:none">
This is a test <br/> This is atest
</div>
As sushanth reddy indicated in the comments, set the z-index of the dialog:
Reference: http://docs.jquery.com/UI/API/1.8/Dialog#option-zIndex
UI dialogs are not singleton You can open as many dialogs as you want. And by default they are stacked. but when Dialog get focused it came up infront of other dialogs.
here is fiddle i created for you. Open dialog from first dialog
I've put drop down on first dialog and on change event I opened another dialog above the first dialog.
You can open any number of modals and the default behavior is stacking in the order they were opened.
Demo: jsFiddle
Just wanted to let future finders know. It is possible to use z-index to put a modalWidget over another. I'm using jquery ui 1.10.3.
The way you go about it is, you give your dialog constructor a dialog class.
Then in your CSS, you specify a higher z-index than the first dialog is using.
You may need to check which one its using with firebug or some dev tool to check which z-index it was instanced with. My default z-index was 90 on the first modal Widget. The window code looked smthg like this: