PDA

View Full Version : DHTML Modal Window parent refresh



D3rG4mml3r
04-10-2008, 02:34 PM
) Script Title: DHTML Modal Window Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm

3) Describe problem: I am working on a little script. Its like a list and you can add new entries. If you added an entry you can edit it and thats where the modal window takes place. It opens if you click edit and loads the data from the selected entry into the form. Now if you change something and then submit it hides the window but the entry looks still the same as before. I need to refresh the page before the change is visible. Is there a possibility to do a refresh after submit so that the entry is already changed without a userforced refresh?

I am thankfull for every help

cnek03
05-20-2008, 02:39 PM
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

gobi13
04-29-2009, 02:42 AM
Hi folks..

I am also facing some problems in that page partial reload. Am not getting it done.
The scenario is something like am having a parent window with a table. The table first column is having an hyperlink from which u call the modal window.

also am having a button to add new entry.

in modal window i have fields for data entry. I have an submit button in the modal window. on clicking the submit buttoni n the modal window the form submitted into the database.

On closing the modal window
i have written a custom function call in the onclose function of the modal window.
But the problem is only after return true the modal window submitted. whatever the AJAX function call prior to the return statement gives the old data only. Tired of finding solution for this :confused::confused::confused::

gobi13
04-29-2009, 07:35 AM
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
Can u please tell me the procedure that i should follow for making the ajax call in the onclose function of the modal window?
because i have a form submission in the modal window itself.
am not doing any modal window form submission in the parent window from which am calling the m modal window.

Thanks