ginerjm Posted May 26, 2011 Share Posted May 26, 2011 I figured out how to use a showmodaldialog call to open up a 'login' window. It gets called from the current form, pops up on top of the current form, does the login and then closes itself, leaving control back with the current form. What I WANT to do is force the current form to do a refresh using another js call, but how can I trigger that? Is there some kind of "wait" mechanism that I can set when I do the showmodaldialog call so that I can then execute the refresh function and then turn control back to the user? Quote Link to comment https://forums.phpfreaks.com/topic/237574-trigger-an-action-after-a-modaldialog-closes/ Share on other sites More sharing options...
trq Posted May 27, 2011 Share Posted May 27, 2011 showmodaldialog is not a built in function so you might want to at least mention what third code you are asking about. Quote Link to comment https://forums.phpfreaks.com/topic/237574-trigger-an-action-after-a-modaldialog-closes/#findComment-1220951 Share on other sites More sharing options...
hemo-ali Posted May 27, 2011 Share Posted May 27, 2011 this works good <script type="text/javascript" src="jquery.js"> </script> <script type="text/javascript"> window.onload = function() { var mySelect = document.getElementById('school2'); mySelect.onchange = function() { if (this.value == 'other') { document.getElementById('otherdiv').style.display = 'block'; } else { document.getElementById('otherdiv').style.display = 'none'; } } } </script> <select id="school2"> <option>1</option> <option>2</option> <option>other</option> </select> <div id="otherdiv" style="display: none;"> asd </div> Quote Link to comment https://forums.phpfreaks.com/topic/237574-trigger-an-action-after-a-modaldialog-closes/#findComment-1221027 Share on other sites More sharing options...
ginerjm Posted May 27, 2011 Author Share Posted May 27, 2011 Thanks for the feedback people, but I have to say I don't understand either reply. thorpe - if showmodaldialog is not a built-in function, then what the h. is it? hemo-ali - thank you for the code you posted, but what the heck is it doing? Doesn't seem to address my problem. A brief re-telling of my needs: form has a button that opens up a dialog box wherein the user does something that affects the calling form. User closes the dialog and I want the calling form to refresh itself automatically so that the user sees confirmation of the changes he/she made by using the dialog box. Quote Link to comment https://forums.phpfreaks.com/topic/237574-trigger-an-action-after-a-modaldialog-closes/#findComment-1221232 Share on other sites More sharing options...
trq Posted May 27, 2011 Share Posted May 27, 2011 thorpe - if showmodaldialog is not a built-in function, then what the h. is it? I have no idea. Are you using some framework like jQuery or Mootools? Maybe it's a part of that? Quote Link to comment https://forums.phpfreaks.com/topic/237574-trigger-an-action-after-a-modaldialog-closes/#findComment-1221414 Share on other sites More sharing options...
ginerjm Posted May 27, 2011 Author Share Posted May 27, 2011 it's just a js function that I found on the net. works great. Here's a link to it. http://javascript.gakaa.com/window-showmodaldialog-4-0-5-.aspx Quote Link to comment https://forums.phpfreaks.com/topic/237574-trigger-an-action-after-a-modaldialog-closes/#findComment-1221416 Share on other sites More sharing options...
hemo-ali Posted May 28, 2011 Share Posted May 28, 2011 I am very sorry for the code above it is a mistake I am very sorry Quote Link to comment https://forums.phpfreaks.com/topic/237574-trigger-an-action-after-a-modaldialog-closes/#findComment-1221515 Share on other sites More sharing options...
ginerjm Posted May 28, 2011 Author Share Posted May 28, 2011 solved my own problem. It seems that the mere fact that I have opened up a modal dialog (showmodaldialog), my executing function is waiting upon the dialog's return. Tada!! I simply added a line to refresh my 'main' window right after the call - which executes only when the dialog returns. Here is my function in my main window: function OpenLoginWin() { var url = 'http://voorheesvillefd.org/vfdlogin1.php'; myWindow = window.showModalDialog(url,"","dialogWidth:430px;dialogHeight:390px;center:yes;status:no;resizable:no"); window.location.reload(); /* force a reload of this page to show the logged in name at the top */ } Quote Link to comment https://forums.phpfreaks.com/topic/237574-trigger-an-action-after-a-modaldialog-closes/#findComment-1221664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.