Jump to content

trigger an action after a modaldialog closes?


ginerjm

Recommended Posts

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?

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 */

}

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.