Forum Moderators: open
After submitting the form, it automatically opens a window maximized showing the results on their server. I was wondering if I could define the window size and not have any toolbars, etc. instead...
The code looks like this:
<FORM NAME=**** ACTION="http://****?ID=0000" METHOD="POST" style="margin: 0px">
<INPUT TYPE=hidden NAME=ID VALUE="0000">
Is there a way to use the FORM ACTION with a javascript window.open function?
Or another other way possible!
Thank you for reading.
onsubmit = "return window.open('','reswin','_configuration_stuff_')" I can't remember whether it needs the
return or not. When I last tried, it opened the popup at the URL given in the action attribute. I hope it functions properly, and sends all the form info too. Give it a go.
onsubmit = "return window.open('','reswin','_configuration_stuff_')"
Did you want me to replace the 'reswin' part with 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=800,height=550'?
Sorry, I am sort of new at this.
open() takes 3 arguments, all strings: open(arg1, arg2, arg3)
arg1: The URL for the new window.
arg2: The name for the new window. If open is used again with the same name as a window that is already open, then that window is directed to the URL, rather than a new window being opened.
arg3: The configuration, 'width=100,height= ...etc'
I was suggesting you put the open command into the onsubmit handler, leaving arg1 blank (''). arg2 is entirely up to you, as is the configuration, arg3.
I added it like this...
<FORM NAME=test ACTION="www?ID=0000" METHOD="POST" style="margin: 0px" onsubmit = "return window.open('','new window','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=800,height=550')">
<INPUT TYPE=hidden NAME=ID VALUE="0000">
But it just opened it maximized like always :\
arg2 is entirely up to you
..well not entirely perhaps. You're not allowed spaces et al.
Let's call it "newwin"
One further thing needed it seems (<form> tag):
target = "newwin" Now it seems to work (at least it opens a customised window, at the URL)
Target is deprecated in XHTML (ok in HTML4 though). If that really matters, you could add the attribute via Javascript.
<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')">
<INPUT TYPE=hidden NAME=ID VALUE="0000">
It seems to just open a window like the command target="_blank". It didn't seem to open with the attributes.
I've tried adding the target = "newwin" at the end of the <FORM> tag but same results...