Form HTML Submit in popup

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Johan

    Form HTML Submit in popup

    I have a form that submit to the same page when double click on a product:
    <form method="post" action="quotes. asp" name="form1"
    onDblClick="jav ascript:formHan dler()">


    How can I submit the form in a popup window and another page using a html
    link?
    Following code doesn't work because of the nested apostrophes in the
    javascript.

    <a href="#"
    onclick="window .open('javascri pt:document.for m1.action='save quote.asp';
    document.form1. submit();','pop up','width=150, height=100,top= ' + topPos +
    ',left=' + leftPos);">Save Quote</a>



    <script language="JavaS cript">
    var w = 400, h = 200;
    if (document.all || document.layers ) {
    w = screen.availWid th;
    h = screen.availHei ght;
    }
    var popW = 200, popH = 150;
    var leftPos = (w-popW)/2, topPos = (h-popH)/2;
    </script>


  • Vincent van Beveren

    #2
    Re: Form HTML Submit in popup

    > How can I submit the form in a popup window and another page using a html[color=blue]
    > link?[/color]

    You need to define the form in the following manner (note the target):

    <form action="savequo te.asp" target="popup" name="quote">
    ... form data ..
    </form>

    The link like this

    <A HREF="javascrip t:saveQuote();" >Save Quote</A>

    And some script code

    <SCRIPT LANGUAGE="JavaS cript">

    function saveQuote() {

    // first open window with right target
    popup = window.open("ab out:blank", "popup", "etc..");

    // then submit form into this window
    document.quote. submit();
    }


    </SCRIPT>

    That should work.

    Comment

    • Randy Webb

      #3
      Re: Form HTML Submit in popup

      Vincent van Beveren wrote:[color=blue][color=green]
      > > How can I submit the form in a popup window and another page using a[/color]
      > html[color=green]
      > > link?[/color]
      >
      > You need to define the form in the following manner (note the target):
      >
      > <form action="savequo te.asp" target="popup" name="quote">
      > ... form data ..
      > </form>
      >
      > The link like this
      >
      > <A HREF="javascrip t:saveQuote();" >Save Quote</A>[/color]

      And then read this:

      [color=blue]
      > And some script code
      >
      > <SCRIPT LANGUAGE="JavaS cript">[/color]

      <script type="text/javascript">
      [color=blue]
      > function saveQuote() {
      >
      > // first open window with right target
      > popup = window.open("ab out:blank", "popup", "etc..");
      >
      > // then submit form into this window
      > document.quote. submit();[/color]

      document.forms['quote'].submit();
      [color=blue]
      > }
      >
      >
      > </SCRIPT>
      >
      > That should work.
      >[/color]


      --
      Randy
      Chance Favors The Prepared Mind
      comp.lang.javas cript FAQ - http://jibbering.com/faq/

      Comment

      Working...