PDA

View Full Version : problem calling close function for dhtmlmodal



davidpoor
02-09-2009, 02:51 AM
1) Script Title: DHTML Modal window v1.1

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

3) Describe problem:
I am using an inline dhtml modal window. When I close it by clicking on the "X" icon, the window and veil close properly. However, I also want to be able to call the close function with a script: when I do, the window closes properly, but the veil is not removed.

To replicate, run "TestdhtmlWindows.html". Open the first window by clicking on the "OPEN 1" button. Then close the window by using the X icon or click on the "CLOSE" button within the window. (Note: for the attachment, the test script is appended with .txt suffix. Paths for the css and javascript will need to be changed.)

PS: I do not have a version id for the dhtmlwindow or dhtmlmodal modules, but I believe that they are current.

davidpoor
02-12-2009, 06:33 PM
I have downloaded the latest scripts and still have the same issue: the veil is not removed with a call to mydhtmlWindowObject1.dhtmlWindow.close();

I have posted a very simple example at:
http://www.mbiltd.net/dhtmlTest/TestdhtmlModalClose.html

ddadmin
02-12-2009, 10:36 PM
Does this happen when you test out the DHTML modal window by itself on the page, instead of toggling between non modal and modal windows? It's a little difficult to tell at the moment what the issue is due to the changes you've made.

davidpoor
02-13-2009, 04:30 AM
Thank you for the reply and I apologize if I made the test overly complex.

The short answer is yes. I first observed the problem with a straight DHTML modal window. I wrote the test module to let me see if the problem is with both dhtmlmodal and dhtmlwindow. It appears that the close function works as expected with dhtmlwindow, but not dhtmlmodal.

I have uploaded a stripped down version that only uses dhtmlmodal: http://www.mbiltd.net/dhtmlTest/TestdhtmlModalOnlyClose.html

Just click the OPEN 1 button and then, in the window, click on the CLOSE button to replicate the issue.

Note that the original demo also lets you select dhtmlwindow and shows that the close button does seem to work correctly with it, but not with dhtmlmodal.

David

PS: I have made no changes in the source code.

ddadmin
02-14-2009, 05:44 PM
Ok, this does seem like a bug. For the time being, you should call the hide() function instead of DHTML Modal windows. That does correctly hide the veil as well.

davidpoor
02-14-2009, 06:13 PM
Thank you. Yes, I believe that I have identified the source. In the modal.js, the following code

t.hide=function(){dhtmlmodal.close(this)} //OVERWRITE default t.hide() method with new one

probably should be

t.hide=function(){dhtmlmodal.hide(this)} //OVERWRITE default t.hide() method with new one
t.close=function(){dhtmlmodal.close(this)} //OVERWRITE default t.close() method with new one

I have changed the code in my source for modal.js and the close functions works properly. I will try to check the hide function later.

I will also submit this as a bug.

ddsp