Log in

View Full Version : Open new window(submit)



nmajkl
11-10-2007, 09:40 AM
Can you help me with form, when click submit.
I would like creat form, when i click submit open new window, but when I insert before submit (onclick="myOpenWindow()) the script function Validator does not function.


<script language="JavaScript"><!--
buttonClicked=false;
function myOpenWindow() {
myWindowHandle = window.open('about:blank','myWindowName','resizable,status,scrollbars=yes,width=100,height=200,top=0,left=0');
}
//--></script>

<form id="Rezervace_vozidla" name="Rezervace_vozidla" style="position: absolute; left: 9px; top: 365px;" action="Rezervace_vozidla_handler.php" method="get" target="myWindowName" onsubmit="if (!buttonClicked) ;">


<input type="submit" id="Odeslat" name="Odeslat" style="width: 85px; height: 19px;" class="button" onclick="myOpenWindow (); buttonClicked=true; setTimeout('document.myForm.submit()',500);return false;" value="ODESALT"></div>


Thank you

Michal

ddadmin
11-11-2007, 08:30 AM
Please format any code in your post using the CODE tag. This makes it a lot easier to read it.

Hmm I'm confused what you're trying to do here- submit a form while opening a pop up window, or actually submit the form so the returned result shows up in a pop up instead (similar to this script (http://www.javascriptkit.com/script/script2/form2popup.shtml))?

jscheuer1
11-11-2007, 03:18 PM
See:

http://www.dynamicdrive.com/forums/showthread.php?t=26289

vwells02
04-17-2010, 04:59 PM
Can you help me with form, when click submit.
I would like creat form, when i click submit open new window, but when I insert before submit (onclick="myOpenWindow()) the script function Validator does not function.


<script language="JavaScript"><!--
buttonClicked=false;
function myOpenWindow() {
myWindowHandle = window.open('about:blank','myWindowName','resizable,status,scrollbars=yes,width=100,height=200,top=0,left=0');
}
//--></script>

<form id="Rezervace_vozidla" name="Rezervace_vozidla" style="position: absolute; left: 9px; top: 365px;" action="Rezervace_vozidla_handler.php" method="get" target="myWindowName" onsubmit="if (!buttonClicked) ;">


<input type="submit" id="Odeslat" name="Odeslat" style="width: 85px; height: 19px;" class="button" onclick="myOpenWindow (); buttonClicked=true; setTimeout('document.myForm.submit()',500);return false;" value="ODESALT"></div>


Thank you

Michal
I found this on a forum the other day and I use First Page 2000 for my html editor. This uses their button form and it works.
<form><input type="button" value="Any site name" onclick="window.open('http://www.any_site.htm','_blank');"></form>
There is no script needed except for their button form. I just replaced what they had with this.

Vern