Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

on submitting a form how will i open it in a customised window in ie7?

opening a customized window on form submit in ie7

3:01 pm on Jan 10, 2008 (gmt 0)

5+ Year Member

<FORM NAME=test ACTION="www?ID=0000" target = "newwin" METHOD="POST" style="margin: 0px" onsubmit = "return window.open('','newwin','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=800,height=550')">

i tried to use this . but it didnt work! can anyone help me please?

4:44 pm on Jan 10, 2008 (gmt 0)

10+ Year Member

I'd suggest to use this:
<FORM NAME=test ACTION="www?ID=0000" target = "_blank" METHOD="POST" style="margin: 0px">

this should already open destination url (www?ID=0000) in a new window. But if you really want to have the new window customized, you might try adding the window.open into the submit button's onclick instead of the form's onsubmit, as there's a chance that the window will be blocked by a popup blocker (or the javascript implementation does not allow windows opened from onsubmit). Most of these software are working in that way, that when the user initiates the opening of the window (by clicking on a button, or link), then it allows it, but any any other case it isn't. Although that's just an idea.

Besides of that if you put "return window.open(...)" into the onsubmit, then the form can not be submitted when the window was not opened (window.open returns false), but when the window is opened, it returns a javascript window object, which is not false, but not true either, so I'd move this command to a function, and return boolean values only to onsubmit.

By the way, I quickly checked it in on both FF2 and IE6, and it was working as expected.

4:56 pm on Jan 10, 2008 (gmt 0)

5+ Year Member

Thanks a lot doode! before submitting the form i used this and it worked!

document._rfxShowFile.target = "newwin";