Forum Moderators: open

Message Too Old, No Replies

Form submit & results show as custom window size

I'm confused! Would like some assistance...

         

pinokiyo

1:20 pm on Jul 16, 2004 (gmt 0)

10+ Year Member



I think this has been asked before but mine is a bit different and I have no clue as well.

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.

Bernard Marx

8:55 pm on Jul 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I saw something the other day.
Put this in the form tag:

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.

pinokiyo

3:23 am on Jul 17, 2004 (gmt 0)

10+ Year Member



I didn't quite get what you meant by the 'reswin' and _configuration_stuff_

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.

Bernard Marx

9:42 am on Jul 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry. I assumed you were familiar with open(), since you mentioned it.

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.

pinokiyo

10:23 am on Jul 17, 2004 (gmt 0)

10+ Year Member



Yeah, that's what I thought you meant...

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 :\

Bernard Marx

10:50 am on Jul 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.

pinokiyo

11:25 am on Jul 17, 2004 (gmt 0)

10+ Year Member



Okay, this is what I have now...

<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...

Bernard Marx

12:30 pm on Jul 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your exact code works for me [IE5, NS6].
Perhaps there's something that's been changed - I dunno :)

pinokiyo

1:33 pm on Jul 17, 2004 (gmt 0)

10+ Year Member



Hmm... I don't think it really matters but I'm using rollover image for the submit button using Javascript.

It almost worked! >_<

pinokiyo

1:35 pm on Jul 17, 2004 (gmt 0)

10+ Year Member



Nothing else goes in the <HEAD> section?

blue9217

11:02 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



I came across this post when I was looking to do the same thing. Is there any way to guarantee that the new window will have the focus when the form is submitted?

pinokiyo

3:42 pm on Jul 22, 2004 (gmt 0)

10+ Year Member



Oh, it worked! The rollover submit had a conflict I think. And also it gave me an access error or whatever when I tried to preview with frontpage but it worked when I opend it on the browser.