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

Submit, close window and refresh parent

Status
Not open for further replies.

mjhaston

Programmer
Oct 9, 2006
5
US
I've found some script that I can work with on this, but I'm very green to JavaScripts.

I am writing a CGI application. I have a parent page that I have a button on to open a pop-up window. This window should submit a form so that a record is added. It should then close the window and refresh the parent, showing the new record.

I find that I am closing and refreshing just fine. I need to actually submit the form and that's where I'm stuck.

Here are some of the key code snippets ...



<SCRIPT language=JavaScript>
<!--
function win(){
document.addCarton.submit();
window.opener.location.href="/pathName/programName";
self.close();
//-->
}
</SCRIPT>


<form name="addCarton" method="/pathName/programName">


<input name="addBtn" type="submit" id="addBtn" value="Add Carton" onClick="win();">




When run .. win() seems to run because it closes the window and refreshes the page. But I don't think the form is submit!



 
Code:
<form name="addCarton" action="/pathName/programName" method="POST">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top