Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

submit form and close parent window 2

Status
Not open for further replies.

leahyj

MIS
May 5, 2004
107
US
Hi,

What is the best way to submit a form, and then close the window that the form is submitted from.

This works in Internet Explorer:

Code:
<form name="paynow_frm" method="post" target="_blank"action="[URL unfurl="true"]http://test.asp"[/URL] onsubmit="javascript:return window.close();paynow_liens();">

but not in firefox.

Thanks
 
How about closing the parent window in child window?

Put this on test.asp:

<body onload="window.opener.close();">
 
Kendel,

That sounds like an excellent idea, unfortunately, the test.asp is actually another entities web site, and I don't have control over it.

Thanks.
 
then i think your best bet is probably a timeout. honestly though, why do you need this? nobody's gonna be terribly turned off of your site because your form submits to a new window...



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
cLFlaVA:

Yes, your probably right, but the reason why I want the form submittal window to close is because the form submittal is already in a new window, and I would rather not have the user dealing with to many windows, and it might prevent the user from switching back to the form and resubmitting. You know users.

How or should I say where do you suggest the timeout?

Also, is it possible to put the window.close on the "action=" method?

Thanks
 
my suggestion is to give up on this.

if you must, you can do something like:

Code:
<form ... onsubmit="setTimeout('window.close()', 1000);">

the 1000 means wait 1000 milliseconds before performing this action. in other words, one second.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
cLFlaVA,

setTimout did the trick. Thanks again.
 
woohoo - go cory, go cory [wiggle]

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top