PDA

View Full Version : Modal once per session not working



emgproductions
11-24-2009, 12:13 PM
1) Script Title: DHTML Modal

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

3) Describe problem:
The modal window (iframe) is opening successfully, I have updated to use the "optional once per session" JS file and I have added the "sessiononly" to the script code.

But the modal window is still opening each time the page is visited. What am I doing wrong? Thanks so much!

Sample page: http://www.horsevideolibrary.com/01_replace/01_barn_stable/01_barn_stable.php

jscheuer1
11-24-2009, 01:26 PM
Well yes it appears you've updated the dhtmlwindow script to one that allows once per session. However, it's clear that the modal.js script isn't passing your parameter about the session on to the updated dhtmlwindow script. Now there could be other problems, but this is the first thing I would try - In modal.js find the open function as shown below and add the highlighted:


open:function(t, contenttype, contentsource, title, attr, recalonload, session){
var d=dhtmlwindow //reference dhtmlwindow object
this.interVeil=document.getElementById("interVeil") //Reference "veil" div
this.veilstack++ //var to keep track of how many modal windows are open right now
this.loadveil()
if (recalonload=="recal" && d.scroll_top==0)
d.addEvent(window, function(){dhtmlmodal.adjustveil()}, "load")
var t=d.open(t, contenttype, contentsource, title, attr, recalonload, session)
t.controls.firstChild.style.display="none" //Disable "minimize" button
t.controls.onclick=function(){dhtmlmodal.close(this._parent, true)} //OVERWRITE default control action with new one
t.show=function(){dhtmlmodal.show(this)} //OVERWRITE default t.show() method with new one
t.hide=function(){dhtmlmodal.close(this)} //OVERWRITE default t.hide() method with new one
return t
},

emgproductions
11-24-2009, 02:05 PM
Hi John and thanks for getting back to me so quickly.

I made the change to modal.js, but this is what is happening:

1) on first open of the page, modal window plays fine;
2) upon return to the page, the overlay background opens, no iFrame window, and no way to "get out" of the modal window.

Any more suggestions? thanks again!

Sample page: http://www.horsevideolibrary.com/01_replace/01_barn_stable/01_barn_stable.php

jscheuer1
11-24-2009, 03:10 PM
Whoopsie! I did say that there might be other problems, sheesh - was there ever. One more addition should take care of it:


open:function(t, contenttype, contentsource, title, attr, recalonload, session){
if(session && persistobj.getCookie(t)!=""){return}
var d=dhtmlwindow //reference dhtmlwindow object
this.interVeil=document.getElementById("interVeil") //Reference "veil" div
this.veilstack++ //var to keep track of how many modal windows are open right now
this.loadveil()
if (recalonload=="recal" && d.scroll_top==0)
d.addEvent(window, function(){dhtmlmodal.adjustveil()}, "load")
var t=d.open(t, contenttype, contentsource, title, attr, recalonload, session)
t.controls.firstChild.style.display="none" //Disable "minimize" button
t.controls.onclick=function(){dhtmlmodal.close(this._parent, true)} //OVERWRITE default control action with new one
t.show=function(){dhtmlmodal.show(this)} //OVERWRITE default t.show() method with new one
t.hide=function(){dhtmlmodal.close(this)} //OVERWRITE default t.hide() method with new one
return t
},

There could still be another issue, but I think this will be it for this one.

emgproductions
11-24-2009, 03:32 PM
KUDOS! That is working perfectly on this one page. I will update all the pages now and we should be good to go! Thanks ever so much, as there's no way I would ever have figured this one out on my own.

emgproductions
11-24-2009, 03:51 PM
UPDATE! All is working perfectly on all pages with the code! Again, many thanks for you help.