Post multiple forms

Discussion in 'Javascript' started by Fabri, Jan 12, 2005.

  1. Fabri

    Fabri Guest

    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.))
    Fabri, Jan 12, 2005
    #1
    1. Advertising

  2. Fabri

    McKirahan Guest

    "Fabri" <> wrote in message news:...
    > 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.))


    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="submit2()">
    </body>
    </html>
    McKirahan, Jan 12, 2005
    #2
    1. Advertising

  3. Fabri wrote:

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


    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.target = '_blank';
    document.forms.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
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jan 12, 2005
    #3
  4. Fabri

    Fabri Guest

    Martin Honnen wrote:

    > 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.target = '_blank';
    > document.forms.submit();
    > }



    AWESOME!!!!!!

    --
    Fabri
    (Incredibile come si tenda a credere di piu` a Rossi. (cit.))
    Fabri, Jan 12, 2005
    #4
  5. Fabri

    rf Guest

    "Martin Honnen" <> wrote
    >
    >
    > Fabri wrote:
    >
    > > Is it possible to post all (or more of one) forms simultaneosly?

    >
    > 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.target = '_blank';
    > document.forms.submit();
    > }


    Which will result in a plethora of new windows popping up.

    > 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.



    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.
    rf, Jan 12, 2005
    #5
  6. Fabri

    Fabri Guest

    rf wrote:

    [CUT]

    > 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.



    Can you give us an example please?

    Regards.

    --
    Fabri
    (Incredibile come si tenda a credere di piu` a Rossi. (cit.))
    Fabri, Jan 13, 2005
    #6
  7. Fabri

    rf Guest

    "Fabri" <> wrote
    > rf wrote:
    >
    > [CUT]
    >
    > > 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.

    > Can you give us an example please?


    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="updatedatabase.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.
    rf, Jan 13, 2005
    #7
    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. Keltex
    Replies:
    1
    Views:
    392
    Dominick Baier [DevelopMentor]
    Jan 24, 2006
  2. Eric
    Replies:
    2
    Views:
    480
  3. Don Glover the younger

    ASP, FORMS, POST METHOD And Post with out form(???)

    Don Glover the younger, Jul 13, 2003, in forum: ASP General
    Replies:
    0
    Views:
    449
    Don Glover the younger
    Jul 13, 2003
  4. Terri

    Post multiple forms to same page

    Terri, Jan 20, 2004, in forum: ASP General
    Replies:
    2
    Views:
    126
  5. Adam
    Replies:
    8
    Views:
    414
Loading...

Share This Page