?
Solved

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

Posted on 2005-03-21
10
Medium Priority
?
1,616 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
10 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
Technology Partners: 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to implement server side field validation and display customized error messages to the client.
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

770 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