SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Midwest
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form post to a new browser Window

    Hello

    What I am trying to do is post a form but have the results displayed in a new browser window. I know I can use target=”_blank” and the results will be displayed in the new browser window. The problem with this is that I want to specify the width and height of the new window. I thought the below code would be want I need and instead of doing a JavaScript alert, I would do a window.open but the onsubmit is not displaying the alert message.

    Any help on how I could accomplish this task would be appreciated.

    Code:
    <form name="frmForm" action="servletName" method="post" target="newWindow" onsubmit="alert('test');">
       <input type="hidden" name="path" id="path" value="" />
    </form>

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you add window-resizing code to the servletName script?

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoting from bytes. com /forum/thread91695.html:

    Code:
    <script>
    function redirectOutput(myForm) {
    var w = window.open('about:blank','Popup_Window','...param s...');
    myForm.target = 'Popup_Window';
    return true;
    }
    </script>
    
    <form action="submit.php" onSubmit="redirectOutput(this)">
    ....
    </form>
    A similar solution is proposed here:

    www . webmasterworld. com/forum91/4951.htm

  4. #4
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Midwest
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not a bad idea… I googled and came across this solution.

    http://support.microsoft.com/kb/287171

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is that some ppl disable window resizing in their browser (Firefox allows this for example), so it's simpler to size it with window.open, I think.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •