
Originally Posted by
cnek03
Ive been using these modal windows now for a little over a year. I find them very handy especially for doing something that you suggest.
What I do is in the onclose event I make an AJAX call that refreshes everything that needs to be refreshed. That the modal window may have changed. You are able to access both the parent and child windows so you are able to get all previously selected elements if necessary.
IE, I have select boxes that I add/delete/modify options from the modal, upon closing, I simply use an AJAX call that rebuilds the select, just getting whatever the database currently has.
On a side note, I had some problems due to the implementation of the modal windows.
When opening the modal:
1. I get the currently selected option, if you want that to still be the same after the modal closes.
2. Make your changes in the modal.
3. In the onclose call your js function within the parent window that can make the AJAX call to rebuild the select.
Notes: This can also be done from the child before the close, but due to timing issues and AJAX running asynchronously, I found it better not to do this and do during the onclose using functions defined in the parent. Also, in the dhtmlwindow.js I remove the x_close image so that way no one is able to forceclose the modal, otherwise you really have to do some work to figure if the modal was closed, since the onclose does not fire. I made a work around, but after the programmers just updated the Modal project, I bagged it because they changed the process and my fix no longer works.
Hope this all makes since and helps, and this same process I use for all of my form fields, that I modify via modal windows. I suggest using SAJAX it works really well and pretty easy to use.
Mike
Bookmarks