Close pop window and refresh the parent window

Discussion in 'ASP General' started by J P Singh, Feb 5, 2004.

  1. J P Singh

    J P Singh Guest

    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
     
    J P Singh, Feb 5, 2004
    #1
    1. Advertising

  2. J P Singh

    Alex Goodey Guest

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

    "J P Singh" <noemail@asIhatespam> wrote in message
    news:%23gbFb$...
    > 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
    >
    >
     
    Alex Goodey, Feb 5, 2004
    #2
    1. Advertising

  3. J P Singh

    J P Singh Guest

    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

    "Alex Goodey" <> wrote in message
    news:bvt51m$102eg4$-berlin.de...
    > what does "stopped" mean?? do you get an error message? what exactly is

    the
    > problem?
    >
    > "J P Singh" <noemail@asIhatespam> wrote in message
    > news:%23gbFb$...
    > > 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
    > >
    > >

    >
    >
     
    J P Singh, Feb 5, 2004
    #3
  4. 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>



    "J P Singh" <noemail@asIhatespam> wrote in message news:<>...
    > 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
    >
    > "Alex Goodey" <> wrote in message
    > news:bvt51m$102eg4$-berlin.de...
    > > what does "stopped" mean?? do you get an error message? what exactly is

    > the
    > > problem?
    > >
    > > "J P Singh" <noemail@asIhatespam> wrote in message
    > > news:%23gbFb$...
    > > > 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
    > > >
    > > >

    > >
    > >
     
    Howard Rothenburg, Feb 11, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Natty Gur
    Replies:
    0
    Views:
    629
    Natty Gur
    Jul 1, 2003
  2. vseshan204
    Replies:
    3
    Views:
    3,684
    Vangi
    Jul 27, 2009
  3. Pkenty
    Replies:
    0
    Views:
    431
    Pkenty
    May 28, 2004
  4. DROdio
    Replies:
    1
    Views:
    119
    Lasse Reichstein Nielsen
    Jul 20, 2003
  5. Madame Blablavatsky
    Replies:
    8
    Views:
    204
    Dr John Stockton
    Sep 16, 2005
Loading...

Share This Page