Posting forms from Javascript

Discussion in 'Javascript' started by Jamie, Jan 12, 2004.

  1. Jamie

    Jamie Guest

    Is it possible to submit a form, from Javascript using the post
    method? From what I've read it is possible. And for some reason, when
    I submit the form from Javascript it insists on using the get method.
    Here's the HTML:

    <form ENCTYPE="multipart/form-data" NAME="upload_form" METHOD=POST
    ACTION="processor?put+58">
    <input type="file" name="userfile" size="30">
    <input type="button" OnClick="Upload()" NAME="op-upload" value="Upload
    File">
    </form>

    Now the Javascript is simply:

    function Upload() {
    document.upload_form.submit();
    }

    and I used to have an alert in there annunciate upload_form.method,
    which is post. For some reason my cgi always receives this as get. So
    far I've been able to test it in Mozilla 5 for Linux, and IE6 for XP.

    Now, if I replace the above submit button, w/a real submit button,
    like this:

    <input type="submit" NAME="op-upload" value="Upload File">

    thereby elimanating the use of Javascript altogether, it sends as
    post, like it should.
     
    Jamie, Jan 12, 2004
    #1
    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. alanb
    Replies:
    2
    Views:
    539
    alanb
    Apr 23, 2004
  2. =?Utf-8?B?SWdneSBFdmFucw==?=
    Replies:
    2
    Views:
    3,077
    =?Utf-8?B?SWdneSBFdmFucw==?=
    Apr 25, 2004
  3. Fernie
    Replies:
    6
    Views:
    557
    Fernie
    Dec 4, 2004
  4. AmitKu
    Replies:
    7
    Views:
    519
    John Timney \(MVP\)
    Jan 8, 2007
  5. Eric
    Replies:
    2
    Views:
    557
Loading...

Share This Page