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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

close after submit

Status
Not open for further replies.

visualJay

Programmer
Jun 14, 2001
57
US
I am tring to get a page to close as soon as the information is submited here is my page minus the BS


<script language=javascript type=&quot;text/javascript&quot;>
<!-- hide from older browsers
function validate(){
if(document.reset.usrname.value==&quot;&quot;){
alert(&quot;You must enter a username&quot;)
return false
}
}
function closeWindow(){
window.close()
}


-->
</script>

<form name=&quot;reset&quot; method=&quot;put&quot; action=&quot;/cgi-bin/reset-pick.pl&quot; onSubmit=&quot;return validate();closeWindow()&quot;>

<b>Enter User Name!</b><br>
<input type=&quot;text&quot; name=&quot;usrname&quot; value=&quot;&quot; size=&quot;30&quot;><br>
<input type=&quot;submit&quot; value=&quot;Submit&quot;><br><br>

<a href=&quot;/support_request.htm&quot;>IT Support</a><br>

</font></p>

</form>

 
when you submit a form the javascript engine shutsdown so you cannot do a submit and then give more instructions to JS.

You can however and this might be better for the user is have a second page appear where the user has confirmation that it was sent and that they can now <a href=&quot;#&quot; onclick=&quot;window.close()&quot;>close</a> this window. Gary Haran
 
The current page after the submit is blank so i want to be able to close the page after the submit pressed or the return key is hit. Can this be done.
 
i'm not sure it can. You would have to try it. You see when a browser submits a form it communicates something to the server. When you close the browser window you might close the connection and the server will not run the query it had received.

I'd be you I wouldn't bother because closing a window on submit is a bit scary for some people. Some might wonder what they did wrong or maybe the browser is buggy. Gary Haran
 
visualJay,
I would reccomend doing the window.close() from the page your action= is on your form.
Daniel
 
My page currently runs a cgi script, in the action the script runs fine just like it is supposed to but the page then shows you an error accured on the server. Yet there is no error. so the information that should go back to the page saying their request id completed and then let them close the page doesnt work properly.
 
my action is a cgi script that returns nothing to the page. the server thinks it threw an error but it doesnot. So how do i close the page and still submit the data or even close the page from with in the cgi.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top