How do I refresh target window?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sirshurf@gmail.com

    How do I refresh target window?

    hello all:

    I have a pop up window is for the user to submit some information.
    That window is refreched a few times with the user inputs (its a form
    submit in itself... couple of times). I would like that window to close
    after the user submits a rating and refreshed the original page that
    opened the window.

    I cant use opener.document .refresh because afterall the page isnt
    considered the opener after the user posts the information on the pop
    up window.

    am i making any sense?

  • nikki

    #2
    Re: How do I refresh target window?


    sirshurf@gmail. com wrote:[color=blue]
    > hello all:
    >
    > I have a pop up window is for the user to submit some information.
    > That window is refreched a few times with the user inputs (its a form
    > submit in itself... couple of times). I would like that window to close
    > after the user submits a rating and refreshed the original page that
    > opened the window.
    >
    > I cant use opener.document .refresh because afterall the page isnt
    > considered the opener after the user posts the information on the pop
    > up window.
    >
    > am i making any sense?[/color]

    Yes, but it is the same window, and it's the window that cares. At
    least, in theory. :)

    And it's reload, not refresh.

    Give it a shot.

    self.opener.doc ument.reload(tr ue);

    Comment

    • Gérard Talbot

      #3
      Re: How do I refresh target window?

      nikki a écrit :[color=blue]
      > sirshurf@gmail. com wrote:
      >[color=green]
      >>hello all:
      >>
      >>I have a pop up window is for the user to submit some information.
      >>That window is refreched a few times with the user inputs (its a form
      >>submit in itself... couple of times). I would like that window to close
      >>after the user submits a rating and refreshed the original page that
      >>opened the window.
      >>
      >>I cant use opener.document .refresh because afterall the page isnt
      >>considered the opener after the user posts the information on the pop
      >>up window.
      >>
      >>am i making any sense?[/color]
      >
      >
      > Yes, but it is the same window, and it's the window that cares. At
      > least, in theory. :)
      >
      > And it's reload, not refresh.
      >
      > Give it a shot.
      >
      > self.opener.doc ument.reload(tr ue);
      >[/color]

      reload is a location method, not a document method.
      And what the original poster needs, I am pretty sure he does not need to
      reload the opener.

      Gérard
      --
      remove blah to email me

      Comment

      • sirshurf@gmail.com

        #4
        Re: How do I refresh target window?

        Nop Not Working....

        My code is (for the reference...)

        On teh parent:

        function newwindow(url) {


        newwindow2=wind ow.open('','Cal lMePopUp','stat us=no,scrollbar s=yes');
        var tmp = newwindow2.docu ment;
        tmp.write('<htm l><head><title> </title>');
        tmp.write('</head><body><for m name="formName" method="post"
        action="calc.ph p">');
        tmp.write('<inp ut type="hidden" name="prodh" value="bred">') ;
        tmp.write('</form>');
        tmp.write('</body></html>');
        tmp.close();

        tmp.formName.su bmit();



        }

        On the chiled:

        function exit ()
        {
        //opener.document .form['new_entry'].submit();
        self.opener.doc ument.reload(tr ue);
        close ();
        }

        The quoted is the one I used before...

        Comment

        • sirshurf@gmail.com

          #5
          Re: How do I refresh target window?

          You are right... I really need to post some information to teh opener,
          and THAN to reload it ... or better tu SUBMIT in it...

          but I cannt... at least I dont know how...

          Comment

          • RobG

            #6
            Re: How do I refresh target window?

            sirshurf@gmail. com wrote:[color=blue]
            > Nop Not Working....
            >
            > My code is (for the reference...)
            >
            > On teh parent:
            >
            > function newwindow(url) {
            >
            >
            > newwindow2=wind ow.open('','Cal lMePopUp','stat us=no,scrollbar s=yes');
            > var tmp = newwindow2.docu ment;
            > tmp.write('<htm l><head><title> </title>');
            > tmp.write('</head><body><for m name="formName" method="post"
            > action="calc.ph p">');
            > tmp.write('<inp ut type="hidden" name="prodh" value="bred">') ;
            > tmp.write('</form>');
            > tmp.write('</body></html>');
            > tmp.close();[/color]

            I think that will be a bit nicer as:

            tmp.document.wr ite(
            '<html><head><t itle></title>'
            + '</head><body><for m name="formName" '
            + 'method="post"> action="calc.ph p">'
            + '<input type="hidden" name="prodh" value="bred">'
            + '</form>'
            + '</body></html>'
            );
            tmp.document.cl ose();
            [color=blue]
            >
            > tmp.formName.su bmit();
            >[/color]

            tmp.document.fo rms['formName'].submit();
            [color=blue]
            >
            >
            > }
            >
            > On the chiled:
            >
            > function exit ()
            > {
            > //opener.document .form['new_entry'].submit();[/color]

            -----------------------------^

            I take it you are aftert he *forms* collection?

            opener.document .forms['new_entry'].submit();

            [color=blue]
            > self.opener.doc ument.reload(tr ue);
            > close ();
            > }
            >
            > The quoted is the one I used before...
            >[/color]

            Untested, but shoule be OK.


            --
            Rob

            Comment

            • RobG

              #7
              Re: How do I refresh target window?

              sirshurf@gmail. com wrote:
              [...][color=blue]
              > On the chiled:
              >
              > function exit ()
              > {
              > //opener.document .form['new_entry'].submit();[/color]

              opener.document .forms['new_entry'].submit();

              ----------------------------^


              [...]

              --
              Rob

              Comment

              • SirShurf

                #8
                Re: How do I refresh target window?

                used: opener.document .forms['new_entry'].submit();

                Still not working... the parent window is not refreshin or submiting...

                Help please...

                Comment

                • SirShurf

                  #9
                  Re: How do I refresh target window?

                  I have opened FireFox that gives a better JS concole... and I am
                  getting

                  Error: opener.document .new_entry.subm it is not a function
                  Source File:
                  Line: 47

                  Comment

                  • RobG

                    #10
                    Re: How do I refresh target window?

                    SirShurf wrote:[color=blue]
                    > I have opened FireFox that gives a better JS concole... and I am
                    > getting
                    >
                    > Error: opener.document .new_entry.subm it is not a function
                    > Source File:
                    > Line: 47
                    >[/color]

                    That means that the form new_entry doesn't exist as far as the function
                    is concerned (it may actually be in the page).

                    Try the following:

                    <html><head><ti tle>Child play</title>
                    </head><body>

                    <script type="text/javascript">

                    function newWin(url) {
                    newWin2=window. open('','CallMe PopUp','');
                    var tmp = newWin2.documen t;
                    tmp.write(
                    '<html><head><t itle></title>',
                    '</head><body><for m name="formName" action="">',
                    '<input type="text" name="prodh" value="bred">',
                    '<input type="submit">' ,
                    '</form>',
                    '<input type="button" value="Submit parent form" onclick="',
                    ' window.opener.d ocument.forms[\'new_entry\'].submit();',
                    'window.close() ;',
                    '">',
                    '</body></html>'
                    );
                    tmp.close();
                    }

                    </script>
                    <input type="button" value="Open child" onclick="newWin ();">
                    <form name="new_entry " action="">
                    <input type="text" name="blah" value="afasdf">
                    <input type="submit">
                    </form>

                    </body></html>


                    --
                    Rob

                    Comment

                    • SirShurf

                      #11
                      Re: How do I refresh target window?

                      I ahve used your script... and thats what I got..

                      Error: window.opener.d ocument.forms.n ew_entry has no properties

                      Comment

                      Working...