Close pop window and refresh the parent window

J

J P Singh

Hi Guys

Wonder if someone can help me with this.

I have a form where a user clicks a button which gives them a pop up windows
to allow them to add the data. The user adds the data and click save. The
pop window closes and refreshs the parent window to allow the entered data
to be displayed.

It was all working okay until couple of days back when it stopped.

Can someone offer any help. I have posted the relevant code here. Please let
me know if you need to see all code.

Thanks

Jas

<body bgcolor="#FFFFFF" text="#000000" onLoad =
"checkClose('<%=bCloseWindow%>')">

function checkClose(flagClose){
if(flagClose==1) {
window.opener.document.thisForm.action = "createExpense.asp"
window.opener.document.thisForm.htbAction.value = "edit"
window.opener.document.thisForm.htbMode.value = "edit"
window.opener.document.thisForm.submit()
self.close()
}


Sub AddExpense()
Dim Rs

GetPostData()
sql = "Insert into expenseDetails (ExpenseId, ExpenseDate, Type,"
sql = sql & "Amount, City, Notes, Receipt, Billable, Bartered,
BarteredDetails"
sql = sql & ") values ("
sql = sql & "'" & strExpenseId & "',"
sql = sql & "'" & strDate & "',"
sql = sql & "'" & strType & "',"
sql = sql & "'" & strAmount & "',"
sql = sql & "'" & strCity & "',"
sql = sql & "'" & strNotes & "',"
sql = sql & "'" & strReceipt & "',"
sql = sql & "'" & strBillable & "',"
sql = sql & "'" & strBarter & "',"
sql = sql & "'" & strBarterDetails & "x'"
sql = sql & ")"
Response.write sql
conn.execute sql
'Get the new detail id
sql = "Select Max(expenseDetailId) as ExpenseDetailId from expenseDetails
where expenseId = " & strExpenseId

set Rs = server.createobject("ADODB.recordset")
Rs.open Sql,conn,1,3
If not Rs.Eof Then
strDetailId = Rs("ExpenseDetailId")
If strBillable = "1" Then AddBillableExpense()
End If
bCloseWindow = "1"

End Sub
 
A

Alex Goodey

what does "stopped" mean?? do you get an error message? what exactly is the
problem?
 
J

J P Singh

Sorry for not being clear enough.

What it does is it adds the data to the table but doesnot close the window.
I have to manually close the pop up window and then press F5 to refresh the
screen and the data i have entered shows up but I would want the pop up
window to close automatically with the back window refreshed.

Thanks

Jas
 
H

Howard Rothenburg

You can use the following to refresh the parent window and close the current window:

<script language="JavaScript">
<!--
function refreshParent()
{
window.opener.location.href = window.opener.location.href;
window.close();
}
//-->
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top