Connecting Tech Pros Worldwide Help | Site Map

How to close the popup window when submitting the form?

  #1  
Old August 28th, 2008, 06:54 AM
Newbie
 
Join Date: Aug 2008
Posts: 2
How to close the popup window when submitting the form?

I have a sample.jsp. In that page one button is there.
when button pressed, open popup window contains one "text box" and one " submit button". when "submit" button pressed, call the "servlet" in this popup window and then close the "popup" window.

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT LANGUAGE="JavaScript">
  2.  
  3. <!-- Begin
  4.  
  5. var X = 200; // change the # at the left for a fixed X co-ordinate to accommodate browsers other than IE or NS
  6.  
  7. var Y = 200; // change the # at the left for a fixed Y co-ordinate to accommodate browsers other than IE or NS
  8.  
  9.  
  10. if (navigator.appName.indexOf("Netscape")!=-1) {
  11.  
  12. document.captureEvents(Event.MOUSEMOVE)
  13.  
  14. function getcoords(e) {
  15.  
  16. X = parseInt(e.screenX) - 80; // change the # at the left to further adjust the left-margin depending on the size of the window
  17.  
  18. Y = parseInt(e.screenY) - 60; // change the # at the left to further adjust the top-margin depending on the size of the window
  19.  
  20. return true;}
  21.  
  22. document.onmousemove = getcoords;
  23.  
  24.  
  25. function openWin() {
  26.  
  27. if (navigator.appName.indexOf("Microsoft")!=-1) {
  28.  
  29. X = parseInt(event.screenX) - 80; // change the # at the left to further adjust the left-margin depending on the size of the window
  30.  
  31. Y = parseInt(event.screenY) - 60; } // change the # at the left to further adjust the top-margin depending on the size of the window
  32.  
  33. display=window.open('','NewWin','menubar=0,location=no,status=no,directories=no,toolbar=no,scrollbar s=yes,height=30,width=230')
  34.  
  35. message="<font face='verdana, arial, helvetica, san-serif' size='2'>";
  36.  
  37. message+="<form name='form1' action='./SaveFile' onsubmit='form1.submit(); self.close();' >"; 
  38.  
  39. message+="Enter Query Name:";
  40.  
  41. message+="<input type='text' name='query_name' />";
  42.  
  43. message+="<input type='submit' value='GO'/>";
  44.  
  45. message+="</form></font>";
  46.  
  47. display.moveTo(X,Y);
  48.  
  49. display.document.write(message); }
  50.  
  51. }
  52.  
  53. // End -->
  54.  
  55. </script>


The above code didn't call the "servlet" but cose the popup window.

I want to call the "servlet" and then close the popup window.

plz help me, how to close the popup window after submitting the form in popupwindow.

Last edited by Dormilich; April 30th, 2009 at 12:09 PM. Reason: fixed code tags
  #2  
Old August 28th, 2008, 11:30 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,528
Provided Answers: 12

re: How to close the popup window when submitting the form?


Close the window on the action page.

PS. some of your code is notoriously old. You should probably upgrade some of that code to work with modern browsers.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot close popup window after submit Gabriella answers 4 January 24th, 2007 12:05 AM
.net / checkbox / popup window Rob Meade answers 1 December 2nd, 2005 11:05 AM
how can i close a pop up from the parent onload JSjones answers 11 July 20th, 2005 02:36 PM
How to close a window after form is submitted? Seth E Seligman answers 2 July 20th, 2005 09:45 AM