You need to sign in to do that
Don't have an account?

Visualforce Save and Close: Saves But Doesn't Close
I've seen several posts out there about this but can't get any of them to work:
Code:
<apex:outputPanel id="outBottom">
<apex:commandButton oncomplete="window.close();" action="{!createTask}" value="Save Task" status="closer" rerender="outBottom"/>
<apex:actionStatus startText="(Saving...)" stopText="" onstop="window.close(); return false;" id="closer"/>
</apex:outputPanel>
Has anyone found a solution to this or is there an error in my code? Thank you in advance!
- http://raydehler.com/cloud/clod/visualforce-perform-action-then-close-window.html
- https://developer.salesforce.com/forums/ForumsMain?id=906F000000095V9IAI
Code:
<apex:outputPanel id="outBottom">
<apex:commandButton oncomplete="window.close();" action="{!createTask}" value="Save Task" status="closer" rerender="outBottom"/>
<apex:actionStatus startText="(Saving...)" stopText="" onstop="window.close(); return false;" id="closer"/>
</apex:outputPanel>
Has anyone found a solution to this or is there an error in my code? Thank you in advance!
Your popup window cannot close itself, as it didn't open itself. I hit exactly this problem with a custom lookup page. The close method needs to be executed from the window that created the popup.
You will need to move your close javascript method to the page that creates the window, and invoke that from the popup page.
https://developer.salesforce.com/forums/ForumsMain?id=906F000000095V9IAI
Regards,
Ashish
All Answers
Your popup window cannot close itself, as it didn't open itself. I hit exactly this problem with a custom lookup page. The close method needs to be executed from the window that created the popup.
You will need to move your close javascript method to the page that creates the window, and invoke that from the popup page.
https://developer.salesforce.com/forums/ForumsMain?id=906F000000095V9IAI
Regards,
Ashish