Solved

onSubmit window.close?

Posted on 2004-08-03
8
2,093 Views
Last Modified: 2008-03-03
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...
0
Comment
Question by:mattybrigh
  • 5
  • 3
8 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 11706176
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();">
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 500 total points
ID: 11706224
better:


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



<form action="submit.asp" method="post" OnSubmit="if (confirm_delete()){window.open('','inventory').close();return true}else return false;">
0
 

Author Comment

by:mattybrigh
ID: 11706242
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.
0
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
LVL 33

Expert Comment

by:knightEknight
ID: 11706247
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();"
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 11706256
can you clarify what you are asking for please?
0
 

Author Comment

by:mattybrigh
ID: 11706389
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.
0
 

Author Comment

by:mattybrigh
ID: 11706434
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!
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 11706860
thanks!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question