Results 1 to 9 of 9

Thread: Window Widget - ghost form from last open

  1. #1
    Join Date
    Nov 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Window Widget - ghost form from last open

    1) Script Title: DHTML Window widget (v1.1)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ndow/index.htm

    3) Describe problem:
    I use Codecharge 2.x. I've build a grid from the database and it creates a link with the onclick event to open the Widget Window (i'm actually using the enhanced Modal version - it's great).

    When I click on the link, my window opens (IFrame mode) and I'm able to see the form i want. I can use the form, post the content, even call another page and all the action takes place in the modal window - perfect !

    when i close the modal window using the X in the corner, i return to the calling page - all is well.

    however, when i click the next link the modal window opens and for a few moments while the form is being fetched, the last form i had open is present on the screen.

    what i'm looking for is a way, when the modal window is closed, to call some function to put a blank page in the IFrame, so when the next link is accessed - the page will be momentarily blank as the other page loads.

    the Ajax method does not do this, however, i cannot manipulate forms in this type of modal window 'cause the window closes whenever i submit a form.

    is there some where i can set the X to run an event like ajaxwin.load('iframe','about:blank','') as it closes the modal window?

    PS - i know i can to a custom close event for a link - however - i create a single link for each record in the data grid and i can't create custom onclose events for each - unless i can reference it in the Hyperlink <A> like <a onclick=' open modal window stuff ; onclose( win.load( blank page )); ??


    help,
    Kevin

  2. #2
    Join Date
    Aug 2004
    Posts
    9,903
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    So are you actually using DHTML window widget, or the modal window derivative? With the former, closing the window should already empty its contents, so opening it again shouldn't cause the last page to be shown temporarily. With the later, the code doesn't take advantage of latest changes yet...

  3. #3
    Join Date
    Nov 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks !
    i was using the modal version 'cause, well, it's modal - too bad it doesn't have this 'clean up' functionality - i've returned to the original window version - it'll do the trick.

    is there somewhere i can trigger a refresh of the calling page (parent?) when the window is closed.

    great script/widget btw !!

  4. #4
    Join Date
    Aug 2004
    Posts
    9,903
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    is there somewhere i can trigger a refresh of the calling page (parent?) when the window is closed.
    Sure. Are you looking to do this for every DHTML window opened then closed, or just a particular window instance? For the later, you could just take advantage of the "onclose" event handler for that window. For example:

    Code:
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://google.com", "Google Web site", "width=700px,height=450px,resize=1,scrolling=1,center=1", "recal")
    
    googlewin.onclose=function(){
    window.location.reload()
    return true
    }

  5. #5
    Join Date
    Nov 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok, i saw that on the web site - that's straight forward when the links are static. problem is that my links are built from CodeCharge data grids, with a window open link at the front of each row...

    i suppose that instead of calling dhtmlwindow.open on each link i could have the link call a 'master' function that calls the open action and has the onclose event code too....please advise, your thoughts - i'm not a sophisticated javascript coder (yet).

    thanks,
    kevin

  6. #6
    Join Date
    Aug 2004
    Posts
    9,903
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    You can certainly modify the .js file so reloading the page becomes a default action on top of any custom onclose code whenever you close a window. But is that what you want though, this behavior automatically added to every DHTML window opened on the page? To do this, inside dhtmlwindow.js, find and make the changes in red below:

    Code:
    	if (closewinbol){ //if custom event handler function returns true
    		window.location.reload()
    		if (t.state!="minimized") //if this window isn't currently minimized
    "

  7. #7
    Join Date
    Nov 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i was thinking:

    ** not exact syntax here **

    in the rows of the data grid:
    <a onclick="MyWindowOpenFunction('MyURLToOpen');"> click here </a>


    at top of page:

    function MyWindowOpenFunction(URLToOpen)

    {
    var ajaxwin=DHTMLWindow.open( parameters...., URLToOpen, parameters...);

    ajaxwin.onclose() {
    window.location.reload()
    return true

    }

    do you think that'll work?

    Kevin

  8. #8
    Join Date
    Aug 2004
    Posts
    9,903
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    It should work, but didn't you mention that using the onclose event handler wasn't feasible since you'll be dealing with non "static" links?

  9. #9
    Join Date
    Nov 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yes, however i'm building the links in each row of the data grid - so if those links call a the function i sketched out in the prev msg, can that function not define the onclose event be fired after the window is closed ?

    the thing changing from row to row is only an ID that controls what data record the form in the DHTML window will fetch, the page called is static.

    kd

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •