"please wait..." in content frame during computation

Discussion in 'Javascript' started by tanager, Nov 6, 2007.

  1. tanager

    tanager Guest

    I have found lots of discussion of said subject, but nothing I try
    will work. I'm hoping that starting this conversation with real
    living people in 2007 will help.

    I have two frames, left is toolbar, right is contents.
    <frameset cols="35%,65%">
    <frame src="../cgi-bin/cmpToolbar.py" name="toolbarFrame">
    <frame src="cmpContents.html" name="contentsFrame">
    </frameset>

    The left frame is CGI, which takes an HTML template file and fills in
    some pulldowns. The right frame is initially blank except for a
    title. Pushing the submit button on the left frame calls CGI script
    cmpRegressions.py, a slow computation/db access, so I want to repaint
    the right side with "please wait..." while this is happening. I want
    this to work after the right side has real contents too, obviously.

    The most straightforward way seems to be using onsubmit or onclick.
    Here is an excerpt of the template file which my left-side cgi fills
    in.

    <head>
    <script type="text/javascript">
    function waitMsg() {
    top.contentsFrame.location = "../cmpreg/cmpWaiting.html";
    document.forms["toolbar"].submit();
    }
    </script>
    <base target="contentsFrame">
    </head>
    <body>
    <FORM id="toolbar" name="toolbar" target=contentsFrame
    METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py"
    ENCTYPE="multipart/
    form-data">
    ....
    ....
    <input type="radio" name="inputType" value="buildset"
    onclick="parent.contentsFrame.location='../cmpreg/cmpWaiting.html';">
    ....
    ....
    <INPUT TYPE="submit" VALUE="compare" onclick="waitMsg(); return
    false;">
    </form>
    </body>

    Nothing I try will make the "submit" button change to the
    cmpWaiting.html page when I click it. It does do the submit() via the
    waitMsg() function, so the script is getting called AFAIK.

    Notice, however, that I try the onclick technique on the "radio"
    button in the middle of the form. It works fine! Of course, that
    input is not running the cmpRegressions.py script, which is what the
    submit button does.

    I've tried putting the javascript code inline in the <input>, I've
    tried onsubmit both in the <input> and in the <form>, I've tried too
    many things to name. I'm pulling out my hair as I write this. What
    am I missing?

    Thanks,
    David

    P.S. I'm not married to frames, but if you suggest something else,
    please bear in mind that I'm a newbie.
     
    tanager, Nov 6, 2007
    #1
    1. Advertising

  2. tanager

    tanager Guest

    On Nov 6, 3:52 pm, tanager <> wrote:
    > I have found lots of discussion of said subject, but nothing I try
    > will work. I'm hoping that starting this conversation with real
    > living people in 2007 will help.
    >
    > I have two frames, left is toolbar, right is contents.
    > <frameset cols="35%,65%">
    > <frame src="../cgi-bin/cmpToolbar.py" name="toolbarFrame">
    > <frame src="cmpContents.html" name="contentsFrame">
    > </frameset>
    >
    > The left frame is CGI, which takes an HTML template file and fills in
    > some pulldowns. The right frame is initially blank except for a
    > title. Pushing the submit button on the left frame calls CGI script
    > cmpRegressions.py, a slow computation/db access, so I want to repaint
    > the right side with "please wait..." while this is happening. I want
    > this to work after the right side has real contents too, obviously.
    >
    > The most straightforward way seems to be using onsubmit or onclick.
    > Here is an excerpt of the template file which my left-side cgi fills
    > in.
    >
    > <head>
    > <script type="text/javascript">
    > function waitMsg() {
    > top.contentsFrame.location = "../cmpreg/cmpWaiting.html";
    > document.forms["toolbar"].submit();
    > }
    > </script>
    > <base target="contentsFrame">
    > </head>
    > <body>
    > <FORM id="toolbar" name="toolbar" target=contentsFrame
    > METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py"
    > ENCTYPE="multipart/
    > form-data">
    > ...
    > ...
    > <input type="radio" name="inputType" value="buildset"
    > onclick="parent.contentsFrame.location='../cmpreg/cmpWaiting.html';">
    > ...
    > ...
    > <INPUT TYPE="submit" VALUE="compare" onclick="waitMsg(); return
    > false;">
    > </form>
    > </body>
    >
    > Nothing I try will make the "submit" button change to the
    > cmpWaiting.html page when I click it. It does do the submit() via the
    > waitMsg() function, so the script is getting called AFAIK.
    >
    > Notice, however, that I try the onclick technique on the "radio"
    > button in the middle of the form. It works fine! Of course, that
    > input is not running the cmpRegressions.py script, which is what the
    > submit button does.
    >
    > I've tried putting the javascript code inline in the <input>, I've
    > tried onsubmit both in the <input> and in the <form>, I've tried too
    > many things to name. I'm pulling out my hair as I write this. What
    > am I missing?
    >
    > Thanks,
    > David
    >
    > P.S. I'm not married to frames, but if you suggest something else,
    > please bear in mind that I'm a newbie.



    Please, please, someone! Trying different combinations, nothing
    working... I removed the submit() call from the function and return
    true instead (i.e., letting the form submit itself). I removed the
    onclick action; put an onsubmit action in the <form> instead. Here is
    what I've got:

    function waitMsg() {
    top.contentsFrame.location.href = "../cmpreg/
    cmpWaiting.html";
    // alert("yo");
    return true;
    }
    .....
    <FORM id="toolbar" name="toolbar" target=contentsFrame
    METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py" ENCTYPE="multipart/
    form-data" onsubmit="return waitMsg();">
    <table>


    Here's an interesting new detail. If I add in the alert() after the
    modification of the location, the "waiting..." page appears on the
    contents side before the real data. This is almost what I want --
    except I don't want the alert -- but I'm hoping it will be a clue for
    someone.

    Note that the alert has this side effect for Firefox 2.0 on Ubuntu,
    but not for IE6 on Windows XP.
     
    tanager, Nov 7, 2007
    #2
    1. Advertising

  3. tanager

    Darko Guest

    On Nov 7, 11:43 pm, tanager <> wrote:
    > On Nov 6, 3:52 pm, tanager <> wrote:
    >
    >
    >
    > > I have found lots of discussion of said subject, but nothing I try
    > > will work. I'm hoping that starting this conversation with real
    > > living people in 2007 will help.

    >
    > > I have two frames, left is toolbar, right is contents.
    > > <frameset cols="35%,65%">
    > > <frame src="../cgi-bin/cmpToolbar.py" name="toolbarFrame">
    > > <frame src="cmpContents.html" name="contentsFrame">
    > > </frameset>

    >
    > > The left frame is CGI, which takes an HTML template file and fills in
    > > some pulldowns. The right frame is initially blank except for a
    > > title. Pushing the submit button on the left frame calls CGI script
    > > cmpRegressions.py, a slow computation/db access, so I want to repaint
    > > the right side with "please wait..." while this is happening. I want
    > > this to work after the right side has real contents too, obviously.

    >
    > > The most straightforward way seems to be using onsubmit or onclick.
    > > Here is an excerpt of the template file which my left-side cgi fills
    > > in.

    >
    > > <head>
    > > <script type="text/javascript">
    > > function waitMsg() {
    > > top.contentsFrame.location = "../cmpreg/cmpWaiting.html";
    > > document.forms["toolbar"].submit();
    > > }
    > > </script>
    > > <base target="contentsFrame">
    > > </head>
    > > <body>
    > > <FORM id="toolbar" name="toolbar" target=contentsFrame
    > > METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py"
    > > ENCTYPE="multipart/
    > > form-data">
    > > ...
    > > ...
    > > <input type="radio" name="inputType" value="buildset"
    > > onclick="parent.contentsFrame.location='../cmpreg/cmpWaiting.html';">
    > > ...
    > > ...
    > > <INPUT TYPE="submit" VALUE="compare" onclick="waitMsg(); return
    > > false;">
    > > </form>
    > > </body>

    >
    > > Nothing I try will make the "submit" button change to the
    > > cmpWaiting.html page when I click it. It does do the submit() via the
    > > waitMsg() function, so the script is getting called AFAIK.

    >
    > > Notice, however, that I try the onclick technique on the "radio"
    > > button in the middle of the form. It works fine! Of course, that
    > > input is not running the cmpRegressions.py script, which is what the
    > > submit button does.

    >
    > > I've tried putting the javascript code inline in the <input>, I've
    > > tried onsubmit both in the <input> and in the <form>, I've tried too
    > > many things to name. I'm pulling out my hair as I write this. What
    > > am I missing?

    >
    > > Thanks,
    > > David

    >
    > > P.S. I'm not married to frames, but if you suggest something else,
    > > please bear in mind that I'm a newbie.

    >
    > Please, please, someone! Trying different combinations, nothing
    > working... I removed the submit() call from the function and return
    > true instead (i.e., letting the form submit itself). I removed the
    > onclick action; put an onsubmit action in the <form> instead. Here is
    > what I've got:
    >
    > function waitMsg() {
    > top.contentsFrame.location.href = "../cmpreg/
    > cmpWaiting.html";
    > // alert("yo");
    > return true;
    > }
    > .....
    > <FORM id="toolbar" name="toolbar" target=contentsFrame
    > METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py" ENCTYPE="multipart/
    > form-data" onsubmit="return waitMsg();">
    > <table>
    >
    > Here's an interesting new detail. If I add in the alert() after the
    > modification of the location, the "waiting..." page appears on the
    > contents side before the real data. This is almost what I want --
    > except I don't want the alert -- but I'm hoping it will be a clue for
    > someone.
    >
    > Note that the alert has this side effect for Firefox 2.0 on Ubuntu,
    > but not for IE6 on Windows XP.


    <html>
    <head>
    <script type="text/javascript">
    function waitMsg() {
    top.contentsFrame.location = "frameRight2.html";
    // this is just so it doesn't load really fast
    // on my local that I don't see if "Loading..." has shown.
    // replace it with:
    // document.forms['toolbar'].submit();
    setTimeout( "document.forms['toolbar'].submit();", 2000 );
    return false;
    }
    </script>
    <base target="contentsFrame">
    </head>
    <body>
    <FORM id="toolbar" name="toolbar" target=contentsFrame
    METHOD="POST"

    ACTION="frameLeft2.html" ENCTYPE="multipart/form-data">
    ....<br />
    ....<br />
    <input type="radio" name="inputType" value="buildset"
    onclick="parent.contentsFrame.location='frameRight2.html';">
    ....<br />
    ....<br />
    <INPUT TYPE="submit" VALUE="compare" onclick="return waitMsg();">
    </form>
    </body>
    </html>
     
    Darko, Nov 8, 2007
    #3
  4. tanager

    tanager Guest

    On Nov 7, 7:42 pm, Darko <> wrote:
    > On Nov 7, 11:43 pm, tanager <> wrote:
    >
    >
    >
    > > On Nov 6, 3:52 pm, tanager <> wrote:

    >
    > > > I have found lots of discussion of said subject, but nothing I try
    > > > will work. I'm hoping that starting this conversation with real
    > > > living people in 2007 will help.

    >
    > > > I have two frames, left is toolbar, right is contents.
    > > > <frameset cols="35%,65%">
    > > > <frame src="../cgi-bin/cmpToolbar.py" name="toolbarFrame">
    > > > <frame src="cmpContents.html" name="contentsFrame">
    > > > </frameset>

    >
    > > > The left frame is CGI, which takes an HTML template file and fills in
    > > > some pulldowns. The right frame is initially blank except for a
    > > > title. Pushing the submit button on the left frame calls CGI script
    > > > cmpRegressions.py, a slow computation/db access, so I want to repaint
    > > > the right side with "please wait..." while this is happening. I want
    > > > this to work after the right side has real contents too, obviously.

    >
    > > > The most straightforward way seems to be using onsubmit or onclick.
    > > > Here is an excerpt of the template file which my left-side cgi fills
    > > > in.

    >
    > > > <head>
    > > > <script type="text/javascript">
    > > > function waitMsg() {
    > > > top.contentsFrame.location = "../cmpreg/cmpWaiting.html";
    > > > document.forms["toolbar"].submit();
    > > > }
    > > > </script>
    > > > <base target="contentsFrame">
    > > > </head>
    > > > <body>
    > > > <FORM id="toolbar" name="toolbar" target=contentsFrame
    > > > METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py"
    > > > ENCTYPE="multipart/
    > > > form-data">
    > > > ...
    > > > ...
    > > > <input type="radio" name="inputType" value="buildset"
    > > > onclick="parent.contentsFrame.location='../cmpreg/cmpWaiting.html';">
    > > > ...
    > > > ...
    > > > <INPUT TYPE="submit" VALUE="compare" onclick="waitMsg(); return
    > > > false;">
    > > > </form>
    > > > </body>

    >
    > > > Nothing I try will make the "submit" button change to the
    > > > cmpWaiting.html page when I click it. It does do the submit() via the
    > > > waitMsg() function, so the script is getting called AFAIK.

    >
    > > > Notice, however, that I try the onclick technique on the "radio"
    > > > button in the middle of the form. It works fine! Of course, that
    > > > input is not running the cmpRegressions.py script, which is what the
    > > > submit button does.

    >
    > > > I've tried putting the javascript code inline in the <input>, I've
    > > > tried onsubmit both in the <input> and in the <form>, I've tried too
    > > > many things to name. I'm pulling out my hair as I write this. What
    > > > am I missing?

    >
    > > > Thanks,
    > > > David

    >
    > > > P.S. I'm not married to frames, but if you suggest something else,
    > > > please bear in mind that I'm a newbie.

    >
    > > Please, please, someone! Trying different combinations, nothing
    > > working... I removed the submit() call from the function and return
    > > true instead (i.e., letting the form submit itself). I removed the
    > > onclick action; put an onsubmit action in the <form> instead. Here is
    > > what I've got:

    >
    > > function waitMsg() {
    > > top.contentsFrame.location.href = "../cmpreg/
    > > cmpWaiting.html";
    > > // alert("yo");
    > > return true;
    > > }
    > > .....
    > > <FORM id="toolbar" name="toolbar" target=contentsFrame
    > > METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py" ENCTYPE="multipart/
    > > form-data" onsubmit="return waitMsg();">
    > > <table>

    >
    > > Here's an interesting new detail. If I add in the alert() after the
    > > modification of the location, the "waiting..." page appears on the
    > > contents side before the real data. This is almost what I want --
    > > except I don't want the alert -- but I'm hoping it will be a clue for
    > > someone.

    >
    > > Note that the alert has this side effect for Firefox 2.0 on Ubuntu,
    > > but not for IE6 on Windows XP.

    >
    > <html>
    > <head>
    > <script type="text/javascript">
    > function waitMsg() {
    > top.contentsFrame.location = "frameRight2.html";
    > // this is just so it doesn't load really fast
    > // on my local that I don't see if "Loading..." has shown.
    > // replace it with:
    > // document.forms['toolbar'].submit();
    > setTimeout( "document.forms['toolbar'].submit();", 2000 );
    > return false;
    > }
    > </script>
    > <base target="contentsFrame">
    > </head>


    OK, fantastic, that has the desired side effect in FF and IE.
    However, I'm still confused.
    - The initial 'contents' page is blank with only a title.
    - The 'wait' page has no title and says to wait.
    - The generated 'results' page has a different background color.
    How could I miss seeing the 'wait' page load between the 'contents'
    and 'results' pages? If 'wait' loaded at all, the 'contents' page
    would disappear, which never happened before I added the setTimeout()
    call. Rather, the 'contents' page used to remain during the
    computation (5 seconds+) and then was quickly replaced by the results.

    Since this workaround works, I don't want to remove the setTimeout()
    call as suggested by the comment. Unless Darko or others can figure
    out how to make it work without the timeout, I'm just going to leave
    it in (with reduced timeout), because this has about driven me crazy.

    Thanks much,
    David
     
    tanager, Nov 8, 2007
    #4
  5. tanager

    Darko Guest

    On Nov 8, 3:39 pm, tanager <> wrote:
    > On Nov 7, 7:42 pm, Darko <> wrote:
    >
    >
    >
    > > On Nov 7, 11:43 pm, tanager <> wrote:

    >
    > > > On Nov 6, 3:52 pm, tanager <> wrote:

    >
    > > > > I have found lots of discussion of said subject, but nothing I try
    > > > > will work. I'm hoping that starting this conversation with real
    > > > > living people in 2007 will help.

    >
    > > > > I have two frames, left is toolbar, right is contents.
    > > > > <frameset cols="35%,65%">
    > > > > <frame src="../cgi-bin/cmpToolbar.py" name="toolbarFrame">
    > > > > <frame src="cmpContents.html" name="contentsFrame">
    > > > > </frameset>

    >
    > > > > The left frame is CGI, which takes an HTML template file and fills in
    > > > > some pulldowns. The right frame is initially blank except for a
    > > > > title. Pushing the submit button on the left frame calls CGI script
    > > > > cmpRegressions.py, a slow computation/db access, so I want to repaint
    > > > > the right side with "please wait..." while this is happening. I want
    > > > > this to work after the right side has real contents too, obviously.

    >
    > > > > The most straightforward way seems to be using onsubmit or onclick.
    > > > > Here is an excerpt of the template file which my left-side cgi fills
    > > > > in.

    >
    > > > > <head>
    > > > > <script type="text/javascript">
    > > > > function waitMsg() {
    > > > > top.contentsFrame.location = "../cmpreg/cmpWaiting.html";
    > > > > document.forms["toolbar"].submit();
    > > > > }
    > > > > </script>
    > > > > <base target="contentsFrame">
    > > > > </head>
    > > > > <body>
    > > > > <FORM id="toolbar" name="toolbar" target=contentsFrame
    > > > > METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py"
    > > > > ENCTYPE="multipart/
    > > > > form-data">
    > > > > ...
    > > > > ...
    > > > > <input type="radio" name="inputType" value="buildset"
    > > > > onclick="parent.contentsFrame.location='../cmpreg/cmpWaiting.html';">
    > > > > ...
    > > > > ...
    > > > > <INPUT TYPE="submit" VALUE="compare" onclick="waitMsg(); return
    > > > > false;">
    > > > > </form>
    > > > > </body>

    >
    > > > > Nothing I try will make the "submit" button change to the
    > > > > cmpWaiting.html page when I click it. It does do the submit() via the
    > > > > waitMsg() function, so the script is getting called AFAIK.

    >
    > > > > Notice, however, that I try the onclick technique on the "radio"
    > > > > button in the middle of the form. It works fine! Of course, that
    > > > > input is not running the cmpRegressions.py script, which is what the
    > > > > submit button does.

    >
    > > > > I've tried putting the javascript code inline in the <input>, I've
    > > > > tried onsubmit both in the <input> and in the <form>, I've tried too
    > > > > many things to name. I'm pulling out my hair as I write this. What
    > > > > am I missing?

    >
    > > > > Thanks,
    > > > > David

    >
    > > > > P.S. I'm not married to frames, but if you suggest something else,
    > > > > please bear in mind that I'm a newbie.

    >
    > > > Please, please, someone! Trying different combinations, nothing
    > > > working... I removed the submit() call from the function and return
    > > > true instead (i.e., letting the form submit itself). I removed the
    > > > onclick action; put an onsubmit action in the <form> instead. Here is
    > > > what I've got:

    >
    > > > function waitMsg() {
    > > > top.contentsFrame.location.href = "../cmpreg/
    > > > cmpWaiting.html";
    > > > // alert("yo");
    > > > return true;
    > > > }
    > > > .....
    > > > <FORM id="toolbar" name="toolbar" target=contentsFrame
    > > > METHOD="POST" ACTION="../cgi-bin/cmpRegressions.py" ENCTYPE="multipart/
    > > > form-data" onsubmit="return waitMsg();">
    > > > <table>

    >
    > > > Here's an interesting new detail. If I add in the alert() after the
    > > > modification of the location, the "waiting..." page appears on the
    > > > contents side before the real data. This is almost what I want --
    > > > except I don't want the alert -- but I'm hoping it will be a clue for
    > > > someone.

    >
    > > > Note that the alert has this side effect for Firefox 2.0 on Ubuntu,
    > > > but not for IE6 on Windows XP.

    >
    > > <html>
    > > <head>
    > > <script type="text/javascript">
    > > function waitMsg() {
    > > top.contentsFrame.location = "frameRight2.html";
    > > // this is just so it doesn't load really fast
    > > // on my local that I don't see if "Loading..." has shown.
    > > // replace it with:
    > > // document.forms['toolbar'].submit();
    > > setTimeout( "document.forms['toolbar'].submit();", 2000 );
    > > return false;
    > > }
    > > </script>
    > > <base target="contentsFrame">
    > > </head>

    >
    > OK, fantastic, that has the desired side effect in FF and IE.
    > However, I'm still confused.
    > - The initial 'contents' page is blank with only a title.
    > - The 'wait' page has no title and says to wait.
    > - The generated 'results' page has a different background color.
    > How could I miss seeing the 'wait' page load between the 'contents'
    > and 'results' pages? If 'wait' loaded at all, the 'contents' page
    > would disappear, which never happened before I added the setTimeout()
    > call. Rather, the 'contents' page used to remain during the
    > computation (5 seconds+) and then was quickly replaced by the results.
    >
    > Since this workaround works, I don't want to remove the setTimeout()
    > call as suggested by the comment. Unless Darko or others can figure
    > out how to make it work without the timeout, I'm just going to leave
    > it in (with reduced timeout), because this has about driven me crazy.
    >
    > Thanks much,
    > David


    It's logical to me that it can't, since you targeted one
    window with one url, and then immediately targeted it with another
    url. The
    browser normally presumes that the first one is unneeded and cancels
    it.

    I think you should base your solution on inserting some contents
    dynamically into
    a container in the current right page, which will happen
    instantaneously, and then
    do the submit() action.
     
    Darko, Nov 8, 2007
    #5
    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. Microsoft
    Replies:
    3
    Views:
    713
    Hugo Wetterberg
    Oct 4, 2004
  2. hazz
    Replies:
    6
    Views:
    49,940
    SkyUCHC
    Jun 9, 2010
  3. traveller
    Replies:
    0
    Views:
    1,234
    traveller
    Jan 8, 2008
  4. Fokke Nauta
    Replies:
    3
    Views:
    972
    Fokke Nauta
    Apr 29, 2009
  5. Replies:
    0
    Views:
    105
Loading...

Share This Page