?
Solved

form action with javascript window.open does not open correctly formatted window

Posted on 2005-03-21
10
Medium Priority
?
1,636 Views
Last Modified: 2012-06-27
When I am submitting a form with the tag:

<FORM NAME="myForm" ACTION="/cgi-bin/example.cgi" target="myNewWindow" METHOD="POST" ONSUBMIT="return validateMe(); window.open('','myNewWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 100,top = 100');">

where validateMe() is a working input validator function

the new window will open full screen with the proper information but will not open with the parameters of the width, height, tool bar etc.

I know that I am missing something very simple here, please help.
0
Comment
Question by:illuminaughty
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 25

Expert Comment

by:archrajan
ID: 13593571
try this
<FORM NAME="myForm" ACTION="/cgi-bin/example.cgi" METHOD="POST"  ONSUBMIT="window.open(this.action,'myNewWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 100,top = 100');">
put back ur validation function i took it out for testing purpose
0
 

Author Comment

by:illuminaughty
ID: 13593758
it is still not working, it is opening in a full new window
0
 
LVL 25

Expert Comment

by:archrajan
ID: 13593777
this page/cgi-bin/example.cgi will open in a full window because thats ur form action...

but the popup window will also open.. in the sizes u mention
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 200 total points
ID: 13594400
<FORM NAME="myForm" ACTION="/cgi-bin/example.cgi" target="myNewWindow" METHOD="POST"
 ONSUBMIT="if (validateMe()) window.open('','myNewWindow','scrollbars,width=600,height=400,left=100,top=100');">
You are not allowed to have spaces in the parameters and no need to specify things not there

or more sure to open the new window with result:

<FORM NAME="myForm" ACTION="/cgi-bin/example.cgi" target="myNewWindow" METHOD="POST">

<input type="button"
onClick="if (validateMe()) {
  window.open('','myNewWindow','scrollbars,width=600,height=400,left=100,top=100');
  setTimout('document.myForm.submit()',200)
}" value="submit">

0
 
LVL 7

Expert Comment

by:searlas
ID: 13594478
The fault in the original question was that you were calling return immediately, so window.open was never called.

Try:
<form
name="myForm"
action="/cgi-bin/example.cgi"
target="myNewWindow"
method="POST"
onsubmit="return (validateMe() && window.open('','myNewWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left=100,top=100'));">
0
 
LVL 7

Expert Comment

by:searlas
ID: 13594485
Sorry mplungjan... hadn't refreshed the page for a while... your answer was first.
0
 

Author Comment

by:illuminaughty
ID: 13594639
thank you all for your help, the one with the if statement worked for me, however it did not pass the parameters into the cgi script. i'll work around it though, and i learned something about that returning submit killing the rest of it, so its not a total loss.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 13594668
it was a typo. sorry
setTimout('document.myForm.submit()',200)
should be
setTimeout('document.myForm.submit()',200)
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question