SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to open new window (after processing form)?

    After I process a user form, I want an invoice to open in a new window. How can I do that? I know this might be a newbie question but I have never done this b4.

    Many thanks!

  2. #2
    SitePoint Evangelist -T-'s Avatar
    Join Date
    Jun 2002
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's done with javascript, but there is a big probability that it will be blocked by a popupblocker. I'm pretty sure it will be blocked by the default one in IE and firefox

    anyhow, the function to open a new window in javascript is window.open()
    http://www.w3schools.com/htmldom/met_win_open.asp
    chrome is a wrapper that combines a browser with spyware

  3. #3
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    You can't do that with PHP but you can do it with HTML. Place target="_blank" in the <form> tag and it will open in a new window.

  4. #4
    SitePoint Evangelist -T-'s Avatar
    Join Date
    Jun 2002
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Didn't think of that one, but there is a problem with it. If you process the form in a new window, the form will still the same in the old one, so when the user closes the window he will be presented with the same form again. How many users will then click submit again cos they think something is wrong? A lot if my experience doesn't fail me

    Since it's an invoice I'm guessing this has to do with purchase, so
    having users post double would be an unwanted annoyance. Means a lot of going back and fixing problems.
    chrome is a wrapper that combines a browser with spyware

  5. #5
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Opening the invoice in a new window is bad idea in general. That form should not be available again after submission. But if they want that they have their choice of drawbacks. Either use JavaScript and have users not have JS turned on and the app breaks or have the form still on their screen.

  6. #6
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    good thoughts all. I think I will have them directed to a page FROM WHICH they can open an invoice in a new window.

    Thanks to all!

  7. #7
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Very good solution.


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
  •