Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>Problem opening popup window after form submit

Problem opening popup window after form submit

pita0017
03-16-2006, 11:08 PM
Hi, I'm trying to open a popup page after my form is submitted, however when i place my window.open code after the form.submit code it will not open the window, like so:


<script language="JavaScript">
function confirmation(f){

if (confirm('Are you sure you want to enter $'+form1.NewMoney.value+' to Account #: '+form1.AccountNumber.value+'? Click "OK" to add money or "CANCEL" to change something')) {

f.submit();
window.open ('/reseller/beepers4less/receipt.php');

}

else {

return false }

}
</script>


when i place the window.open before the f.submit() it will open the window and then submit the form, however, i need the form to be submitted first and then open the window because it passes info to the new page through php sessions, and with the window opening first the page will come up empty...

anyone know why this happens this way?

Thanks in advance. :)

Beagle
03-16-2006, 11:13 PM
submit sends a request, which forces the current page to unload in preparation for the response. This means that right after the submit, subsequent code does not get executed.

You might want to look into using XMLHTTPRequests to submit the form asynchoronously and then open the window.

You could also open the window on the action page of the form, so if the form submits to pagey.php, make pagey.php open the new window.

pita0017
03-16-2006, 11:39 PM
Alright, so now i did this and im not getting a popup. Not sure why it's not working, probably did something wrong, my java sucks, sorry...:(


<SCRIPT LANGUAGE="JavaScript">
function popup(URL) {
window.open(URL,'Receipt');
}
</script>



<form action="<?php echo $editFormAction; ?>" method="POST" OnSubmit="return formValidation(this) && formValidation2(this) && confirmation(this) && popup('/reseller/beepers4less/receipt.php')" name="form1">


thanks for your help beagle.

trendybox
03-17-2006, 03:44 PM
function popup(URL) {
window.open(URL,'Receipt');
}

Where do you call the function popup and what gets passed into it as the URL variable?

why does everyone call javascript "java" aren't they two completely different languages?


 

TOP

Hyperthreading hurts s
HP sharpens blade PC l
Apple goes for Quad po
Itanium gets scaled do

For more info

HP sharpens blade PC l
Hyperthreading hurts s
can not call click() i
script does not work o
smart menu 
write to an html file 
FireFox doesn't recogn
Changing e.keyCode (e.
Clearing a range creat
UPDATE: My mouse over 

News Archive

onChange Help 
beforeload? vs onload.
Problem with document.
decreasing my javascri
Problem with \\ and \ 
how to stop scrolling?
Change Label Text Colo
Can I forward a page b
2 javascript functions
Validating a textbox 

Related stories:

Move Cursor to Position in a Text Area
Sorry Me Again, Need Help with Validating array checkboxes
switch not setting new value
is there an attribute that i can add to all types of form input
Pre-populate content from one text box into another text box
drop down menu - help needed
Dynamic Button not Handling Event
Drag n drop Thumbnail Images to iFrame, with Original Size
Help with an online order form using drop down boxes

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics