reloading windows

Discussion in 'Javascript' started by Sam, Sep 15, 2003.

  1. Sam

    Sam Guest

    I am constructing a company intranet.
    On the intranet I made an overview-page which displays the availability of
    equipment.
    The information comes out of a database, and is retrieved by php-script.
    The users of the database should be able to change the status of the
    equipment.
    On the overview-page, I placed a button next to each piece of equipment.
    On pressing the button, a new window is opened, in which the user can input
    the changes.
    On this new window, a "submit"-button and a "cancel"-button can be pressed.
    On pressing the submit-button, a php-script is called to make the changes in
    the database, on "cancel", the new window is closed.
    After pressing the submit-button, I want the initial overview-page to be
    reloaded (refreshed) with the new information.

    Can anyone help me?

    I already tried this, but nothing happens:

    The overview-page contains the following script:

    <script language="JavaScript" type="text/JavaScript">
    window.name = "materieeloverzicht"
    </script>

    The php page contains the following script:

    <script language="JavaScript" type="text/JavaScript">
    materieeloverzicht.location.reload()
    </script>
     
    Sam, Sep 15, 2003
    #1
    1. Advertising

  2. Sam

    asdf asdf Guest

    If you have the luxury of supporting only Internet Explorer, have a
    look at window.showModalDialog:

    http://msdn.microsoft.com/workshop/author/dhtml/
    reference/methods/showmodaldialog.asp

    There is probably a more elegant solution based on window/frame/form
    naming.

    Hope that helps,
    Ron
     
    asdf asdf, Sep 15, 2003
    #2
    1. Advertising

  3. Sam

    Greg Guest

    "Sam" <> wrote in message news:<y_d9b.21374$-ops.be>...
    > I am constructing a company intranet.
    > On the intranet I made an overview-page which displays the availability of
    > equipment.
    > The information comes out of a database, and is retrieved by php-script.
    > The users of the database should be able to change the status of the
    > equipment.
    > On the overview-page, I placed a button next to each piece of equipment.
    > On pressing the button, a new window is opened, in which the user can input
    > the changes.
    > On this new window, a "submit"-button and a "cancel"-button can be pressed.
    > On pressing the submit-button, a php-script is called to make the changes in
    > the database, on "cancel", the new window is closed.
    > After pressing the submit-button, I want the initial overview-page to be
    > reloaded (refreshed) with the new information.
    >
    > Can anyone help me?
    >
    > I already tried this, but nothing happens:
    >
    > The overview-page contains the following script:
    >
    > <script language="JavaScript" type="text/JavaScript">
    > window.name = "materieeloverzicht"
    > </script>
    >
    > The php page contains the following script:
    >
    > <script language="JavaScript" type="text/JavaScript">
    > materieeloverzicht.location.reload()
    > </script>


    materieeloverzicht looks to be a string not a window reference. You
    have a perfectly good reference to the parent window in the child
    window opener property, but it seems that you can use the window name
    if you call window.open() with the name argument

    // a.htm (parent)
    <script type='text/javascript'>
    window.name = 'bill';
    function openB(){
    window.open('b.htm');
    }
    window.onload = function (){
    window.status = new Date(); // load indicator
    window.setTimeout('window.status = window.defaultStatus', 2000);
    }
    </script>
    <a href='#a1' name='a1' id='a1' onclick='openB(); return false;'>Open
    b.htm</a>


    // b.htm (child)
    <script type='text/javascript'>
    function reloadA(){
    window.open('a.htm', 'bill',);
    }
    </script>
    <a href='#a1' name='a1' id='a1' onclick='reloadA(); return
    false;'>Reload a.htm</a>

    Not an expert. FWIW.
     
    Greg, Sep 16, 2003
    #3
  4. Sam

    DU Guest

    Sam wrote:

    > I am constructing a company intranet.
    > On the intranet I made an overview-page which displays the availability of
    > equipment.
    > The information comes out of a database, and is retrieved by php-script.
    > The users of the database should be able to change the status of the
    > equipment.
    > On the overview-page, I placed a button next to each piece of equipment.
    > On pressing the button, a new window is opened, in which the user can input
    > the changes.
    > On this new window, a "submit"-button and a "cancel"-button can be pressed.
    > On pressing the submit-button, a php-script is called to make the changes in
    > the database, on "cancel", the new window is closed.
    > After pressing the submit-button, I want the initial overview-page to be
    > reloaded (refreshed) with the new information.
    >
    > Can anyone help me?
    >
    > I already tried this, but nothing happens:
    >
    > The overview-page contains the following script:
    >
    > <script language="JavaScript" type="text/JavaScript">
    > window.name = "materieeloverzicht"
    > </script>
    >


    The window.name is just a string for the target. The window name does
    not do much really except in js disabled contexts.

    > The php page contains the following script:
    >
    > <script language="JavaScript" type="text/JavaScript">
    > materieeloverzicht.location.reload()
    > </script>


    You need here a window object reference (not a window name) and you need
    to set the reload to true so that a refresh (unconditional get) at the
    server is mandatory.

    Let's say you did:

    <script type="text/css">
    var WindowObjectReference = null; // must be global scope
    function OpenWindowEquipmentAvailability()
    {
    if(WindowObjectReference == null || WindowObjectReference.closed)
    {
    WindowObjectReference = window.open(strUrl, strWindowName,
    strWindowFeaturesList);
    };
    }
    </script>

    then later you can reload that window with changes thanks to

    <script type="text/javascript">
    WindowObjectReference.location.reload(true);
    </script>
    You could even combine both script content into 1 single one.

    To close after a click of the cancel button, you would call in this order:
    WindowObjectReference.close();
    WindowObjectReference = null;

    DU
    --
    Javascript and Browser bugs:
    http://www10.brinkster.com/doctorunclear/
    - Resources, help and tips for Netscape 7.x users and Composer
    - Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
    http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
     
    DU, Sep 16, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Walter
    Replies:
    2
    Views:
    466
    Walter
    Dec 22, 2003
  2. Scott Vercuski via .NET 247

    Reloading session state

    Scott Vercuski via .NET 247, May 14, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    359
    Scott Vercuski via .NET 247
    May 14, 2004
  3. Phil Winstanley [Microsoft MVP]

    Re: Reloading session state

    Phil Winstanley [Microsoft MVP], May 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    356
    Phil Winstanley [Microsoft MVP]
    May 15, 2004
  4. Urs Vogel
    Replies:
    2
    Views:
    2,449
    Urs Vogel
    Jun 10, 2004
  5. kuldeepiitk

    Reloading

    kuldeepiitk, Jun 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    401
    kuldeepiitk
    Jun 21, 2004
Loading...

Share This Page