Solved

onSubmit window.close?

Posted on 2004-08-03
8
2,097 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to combine and minify CSS and JS files 5 36
How to make google charts responsive 4 46
arrays and radio buttons 10 36
Slush on text 2 8
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

685 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