submit form data to a new window failed using HTTP POST

Discussion in 'Javascript' started by Matt, Aug 23, 2004.

  1. Matt

    Matt Guest

    The following program submit a FORM DATA to a new window using HTTP
    POST,
    and postprocess.jsp couldn't get the form data. If I do in GET method
    and pass
    by query string in windowURL, then it works. But I need HTTP POST
    method,
    and I cannot use target="_blank" because I need to control the new
    window's
    properties (disable the scrollbars, menubars, etc...)

    Are there any workarounds?

    <html>
    <script type="text/javascript">
    function checkAndSubmitForm(theForm)
    {
    var windowURL = theForm.action;
    window.open(windowURL, "newWin",
    "scrollbars=0,menubar=0,toolbar=0,location=0,status=0");
    }
    </script>

    <body>
    <FORM NAME="formname" method="POST" action="postprocess.jsp">
    <P><input type=text" name="username"/>
    <P><input type="button" name="submitBtn" value="Submit Form"
    onClick="checkAndSubmitForm(document.formname)">
    </FORM>
    </body>
    </html>

    postprocess.jsp is just one line statement to get the form data
    <%= Request.Form() %>


    any ideas? please help!! thanks!!
     
    Matt, Aug 23, 2004
    #1
    1. Advertising

  2. Matt

    VK Guest

    var w = window.open("bogus.html", "newWin", ...);
    theForm.target = "newWin";
    theForm.submit();

    where bogus.html is an empty placeholder. may use "about:blank" instead
    which is more elegant but doesn't go smoothly with all browsers.

    good luck!
     
    VK, Aug 23, 2004
    #2
    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. Matt
    Replies:
    4
    Views:
    11,981
    vivekvsingh
    Sep 14, 2006
  2. Matt
    Replies:
    7
    Views:
    5,335
    Isofarro
    Aug 27, 2004
  3. Replies:
    2
    Views:
    6,270
  4. Matt
    Replies:
    1
    Views:
    259
    Bob Barrows [MVP]
    Aug 23, 2004
  5. Replies:
    2
    Views:
    371
Loading...

Share This Page