You need to sign in to do that
Don't have an account?
Sabrent
I have a VFp , which open another VFP as a popup, after the pop is closed, i want the parent page that opened the popup to be refreshed.
My code/javscript closes the VFP popup but it doesnt reload the parent page. I have to manually reload the parent page to see the updated record.
Note: The reason i am using window.open is becuase i want users to have the ability to scroll through the parent window.
Any suggestions????
**********************************************************************************************************************
VFP1
<script type="text/javascript">
function OpenVfpage(){
window.open('/apex/SendEmailPage?id={!recordId}', '_blank','scrollbars=yes,width=600,height=800,resizable=no,toolbar=0,location=0,menubar=0');
}
</script>
<apex:commandButton value="Send Email" id="email" onclick="javascript:OpenVfpage();"/>
**********************************************************************************************************************
VFP2
<script language="javascript" type="text/javascript">
function closeVFP() {
if("{!$Request.success}" == "true") {
parent.window.close();
window.close();
}
</script>
<apex:commandButton id="saveBtn" value="Send" action="{!sendEmail}" onComplete="javascript:closeVFP();"/>
**********************************************************************************************************************
Controller
public PageReference sendEmail(){
// logic to send the email
return new PageReference ('javascript:window.close()');
}
Closing the popup Visualforce page and refreshing the page that opened the popup
I have a VFp , which open another VFP as a popup, after the pop is closed, i want the parent page that opened the popup to be refreshed.
My code/javscript closes the VFP popup but it doesnt reload the parent page. I have to manually reload the parent page to see the updated record.
Note: The reason i am using window.open is becuase i want users to have the ability to scroll through the parent window.
Any suggestions????
**********************************************************************************************************************
VFP1
<script type="text/javascript">
function OpenVfpage(){
window.open('/apex/SendEmailPage?id={!recordId}', '_blank','scrollbars=yes,width=600,height=800,resizable=no,toolbar=0,location=0,menubar=0');
}
</script>
<apex:commandButton value="Send Email" id="email" onclick="javascript:OpenVfpage();"/>
**********************************************************************************************************************
VFP2
<script language="javascript" type="text/javascript">
function closeVFP() {
if("{!$Request.success}" == "true") {
parent.window.close();
window.close();
}
</script>
<apex:commandButton id="saveBtn" value="Send" action="{!sendEmail}" onComplete="javascript:closeVFP();"/>
**********************************************************************************************************************
Controller
public PageReference sendEmail(){
// logic to send the email
return new PageReference ('javascript:window.close()');
}
In the popup window, add this --
This will refresh the parent whenever your popup is unloaded/closed. You can remove the parent.window.close() line from your code.
Please mark this as answer if this answered your question.
<apex:page>
<script type="text/javascript">
function closeWin(){
if(window.parent){
window.parent.opener.location.href = window.parent.opener.location.href;
window.parent.close();
}
else{
window.opener.location.href = window.opener.location.href;
window.close();
}
}
function closeWindow_NoAction(){
window.close();
}
</script>
<apex:commandButton value="Save" action="{!saveRecord}" oncomplete="closeWin();" />
<input type="button" class="btn" value="Cancel" onclick="closeWindow_NoAction();"/>
</apex:page>
Let me know if this works.