Link to home
Start Free TrialLog in
Avatar of mattybrigh
mattybrigh

asked on

onSubmit window.close?

I have a page that opens up a new window.  Here's that code:

<a href="javascript:;" onClick="window.open('addedit.asp?id=<%=RS("id")%>','inventory','toolbars=no,status=no,scrollbars=no,height=275,width=550');"><%=RS("item_name")%></a>

This works fine, but when the user edits what's in that window, it doesn't close.  Can someone tell me what might be wrong with this code?

<form action="submit.asp" method="post" OnSubmit="window.parent.close();window.close();return confirm_delete()">

Any help is greatly appreciated...
Avatar of knightEknight
knightEknight
Flag of United States of America image

I'm not exactly sure what you are asking for, but if you want the "inventory" window to close when the form submits, do this:

<form action="submit.asp" method="post" OnSubmit="window.open('','inventory').close();return confirm_delete();">
ASKER CERTIFIED SOLUTION
Avatar of knightEknight
knightEknight
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mattybrigh
mattybrigh

ASKER

Hmmm...didn't seem to work.  The form works, but once you submit the changes, it goes back to the default.asp page in the popup window.
or even better, add the close statement to the confirm_delete() function just before "return true" in the function.
Then all you need to do is:  onsubmit="return confirm_delete();"
can you clarify what you are asking for please?
I have a page with items on it, the user will click on an item to edit it.  When it's clicked, it opens up a new window (inventory).  They do all their stuff and then when they click the "Edit Inventory Item", the window is supposed to close.  This doesn't happen.  It just displays the default.asp page (the one with all the items on it) in the popup window.
Ok, I figured it out.  There were two forms on the page, the first one for the majority of the fields and a second one that was only used if you delete and item.  I was placeing all of that information there.

Thanks for the help and enjoy the points!
thanks!