+ Start a Discussion

How to close an existing window?

I have created a custom button named addStudent  on class detail page. When i click on this button a pop window open.In this pop window there is a text box to add student name and a save button to save student of that class.I want that when i click on save button the exitsting window with text box and save button should be closed as soon as i click on that button and a student detail page open in place of class detail page.


Is there a specific need to have this achieved via pop-up?  You could have your button open the add student page in the existing window and set the retURL in your custom button back to the original class Id

Imran MohammedImran Mohammed

In your popup window, add javascript function that will close the window.

In the javascript function, call this window.close();


Save button which i hope is a commandButton, add oncomplete attribute to it with the javascript function name.

So, when user clicks save button  the controller action will be invoked and saves the student record and invokes the javascript function after returning to the page.


If you need further help let me know.