Need some help pls

Discussion in 'JavaScript' started by showup, Feb 26, 2007.

  1. #1
    Hithere:

    I have a form that has to be submitted using javascript. The out put of the form submission should open in a popup window. But the parent window should not navigate.

    I was using a simple javascript popup code like this.

    <a href=“#” onClick="window.open('xxx.php','Window','height=500,width=650,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes'); javascript:document.form.submit();">YYY</a>

    This code opens the popup window nicely and the output of form submission is presented in the popup window. However, the problem with this code is that it also navigates the parent window and the form output is presented in both parent and popup window. To overcome this I used the following code.

    <a href="javascript:history.go(0)" onClick="window.open('xxx.php','Window','height=500,width=650,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes'); javascript:document.form.submit();">YYY</a>

    In this case the navigation of parent window is arrested to the history(0). However, in this case the parent window refreshes. I would appreciate if anyone can suggest a code in which the parent window is not affected.
    Thanks.
     
    showup, Feb 26, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
  3. showup

    showup Well-Known Member

    Messages:
    126
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #3
    The above suggestion works great. But i am using an hyperlink and the form values are hidden. Is it possible to replace the button in the above case with a hyperlink? Any help is appreciated.
     
    showup, Feb 27, 2007 IP
  4. showup

    showup Well-Known Member

    Messages:
    126
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    I am still waiting for the help.
     
    showup, Mar 4, 2007 IP
  5. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Replace
    <input type=submit value=Submit>
    Code (markup):
    with
    <a href="javascript:document.forms['main'].submit();">Submit</a>
    
    Code (markup):
     
    Aragorn, Mar 5, 2007 IP