Post multiple forms

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

    Post multiple forms

    Is it possible to post all (or more of one) forms simultaneosly?

    document.forms. submit?

    Any help appreciated.

    Regards.

    --
    Fabri
    (Incredibile come si tenda a credere di piu` a Rossi. (cit.))
  • McKirahan

    #2
    Re: Post multiple forms

    "Fabri" <no@sp.am> wrote in message news:34klkqF4dq tnbU1@individua l.net...[color=blue]
    > Is it possible to post all (or more of one) forms simultaneosly?
    >
    > document.forms. submit?
    >
    > Any help appreciated.
    >
    > Regards.
    >
    > --
    > Fabri
    > (Incredibile come si tenda a credere di piu` a Rossi. (cit.))[/color]

    I don't think you can. I tried the following:

    <html>
    <head>
    <title>submit2. htm</title>
    <script type="text/javascript">
    function submit2() {
    document.form1. submit();
    alert(1);
    document.form2. submit();
    alert(2);
    }
    </script>
    </head>
    <body>
    <form action="submit2 .htm" method="get" name="form1">
    <input type="text" name="text1" value="1">
    </form>
    <hr>
    <form action="submit2 .htm" method="get" name="form2">
    <input type="text" name="text2" value="2">
    </form>
    <hr>
    <input type="button" value="Submit Forms" onclick="submit 2()">
    </body>
    </html>


    Comment

    • Martin Honnen

      #3
      Re: Post multiple forms



      Fabri wrote:
      [color=blue]
      > Is it possible to post all (or more of one) forms simultaneosly?[/color]

      Well probably only if the target is set differently or to a new window e.g.
      for (var i = 0; i < document.forms. length; i++) {
      document.forms[i].target = '_blank';
      document.forms[i].submit();
      }
      If you have forms with no target set then obviously submitting one means
      unloading the current page and then there are not further forms to submit.

      --

      Martin Honnen

      Comment

      • Fabri

        #4
        Re: Post multiple forms

        Martin Honnen wrote:
        [color=blue]
        > Well probably only if the target is set differently or to a new window e.g.
        > for (var i = 0; i < document.forms. length; i++) {
        > document.forms[i].target = '_blank';
        > document.forms[i].submit();
        > }[/color]


        AWESOME!!!!!!

        --
        Fabri
        (Incredibile come si tenda a credere di piu` a Rossi. (cit.))

        Comment

        • rf

          #5
          Re: Post multiple forms

          "Martin Honnen" <mahotrash@yaho o.de> wrote[color=blue]
          >
          >
          > Fabri wrote:
          >[color=green]
          > > Is it possible to post all (or more of one) forms simultaneosly?[/color]
          >
          > Well probably only if the target is set differently or to a new window[/color]
          e.g.[color=blue]
          > for (var i = 0; i < document.forms. length; i++) {
          > document.forms[i].target = '_blank';
          > document.forms[i].submit();
          > }[/color]

          Which will result in a plethora of new windows popping up.
          [color=blue]
          > If you have forms with no target set then obviously submitting one means
          > unloading the current page and then there are not further forms to submit.[/color]


          Why not just cause the server side form handler to return, say, a 204, there
          is no new information to send back? That way the existing page will remain.

          --
          Cheers
          Richard.


          Comment

          • Fabri

            #6
            Re: Post multiple forms

            rf wrote:

            [CUT]
            [color=blue]
            > Why not just cause the server side form handler to return, say, a 204, there
            > is no new information to send back? That way the existing page will remain.[/color]


            Can you give us an example please?

            Regards.

            --
            Fabri
            (Incredibile come si tenda a credere di piu` a Rossi. (cit.))

            Comment

            • rf

              #7
              Re: Post multiple forms

              "Fabri" <no@sp.am> wrote[color=blue]
              > rf wrote:
              >
              > [CUT]
              >[color=green]
              > > Why not just cause the server side form handler to return, say, a 204,[/color][/color]
              there[color=blue][color=green]
              > > is no new information to send back? That way the existing page will[/color][/color]
              remain.
              [color=blue]
              > Can you give us an example please?[/color]

              You are probably better off asking over in the server side groups. alt.php,
              comp.lang.php, or whatever flavour of server side stuff you use.

              Here is a minimal PHP example:

              In your "page"

              <form action="updated atabase.php" ...>
              ....

              In updatadatabase. php:

              <?php
              header("HTTP/1.0 204 No Response"); // terminates this HTTP request
              // do stuff with the data sent up by the form
              // do not output any "content" for this request. That is, no html.
              // the sole purpose of this "page" is to update a database or something.
              ?>

              Google for: php 404 header

              --
              Cheers
              Richard.


              Comment

              Working...