You need to sign in to do that
Don't have an account?
Scott0987
Issue with refreshing opener window and closing the popup window
I have a page that opens a popup window to input a new case comment. when the comment is saved I want it to close the popup window and refresh the page that opened it so that it shows the new comment. It just seems to do nothing. I can replace the code that is supposed to reload the opener window with allert('afadsfdfa'); and it will popup an allert so I know the function is running.
Here is the parent page:
<apex:tab label="Updates"> <!-- script for poup window --> <script type="text/javascript">function newPopup(url) {popupWindow = window.open(url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')}</script> <!-- end script for poup window --> <apex:commandlink onclick="JavaScript:newPopup('{!url}');" >Post Update </apex:commandlink>
Here is the popup page:
<script language="JavaScript" type="text/javascript"> function CloseAndRefresh(){ window.opener.location.reload(true); window.top.close(); } </script> <apex:form > <apex:outputlabel >Enter an update</apex:outputlabel><br /> <apex:inputtextarea value="{!newUpdate}" rows="5" cols="35"/><br /> <apex:commandbutton value="Cancel"/> <apex:commandButton value="OK" action="{!updteCase}" oncomplete="javascript: CloseAndRefresh()" /> </apex:form>
Thanks for any help you can give me.
I recently built something similar to mass update leads. In my case, the user selects leads from a list. When the user clicks a button to edit the selected leads, a pop-up window opons with the field to update. When the user clicks save in the pop-up window it updates the records, alert the user of successfull update and closes itself. While the pop-up is open, the parent window is listening for it to close. When the pop-up window closes, the parent window reloads. Here is the code:
JavaScript in parent window:
Pop-Up page:
Hope this helps!