2011-12-28 87 views
0

我在下面打開此Visualforce頁面的Case對象上有一個按鈕。我希望窗口在保存後關閉,但我似乎無法得到它來捕捉關閉命令。它的功能是點擊保存時,頁面創建記錄,然後刷新頁面以呈現該記錄。我想要它保存記錄並關閉。有任何想法嗎?保存後關閉彈出窗口的visualforce窗口

> <apex:page standardController="dingList__c"> 
    <apex:form > 
      <apex:pageBlock title="{!$User.FirstName} reason's for re-queuing:"> 
       <apex:pageMessages /> 
       <apex:pageBlockButtons > 
       <apex:commandButton action="{!save}" value="Save" status="closer" rerender="buttons"/> 
       <apex:commandButton value="Cancel" onclick="window.top.close()"/> 
       <apex:actionStatus startText="(Saving...)" stopText="" onStop="window.top.close();" id="closer"/> 
       </apex:pageBlockButtons> 
       <apex:pageBlockSection > 
        <apex:inputField id="reason" value="{!dingList__c.Reason__c}"/> 
       </apex:pageBlockSection> 
      </apex:pageBlock> 
     </apex:form> 
</apex:page> 

回答

1

與此標記創建Visualforce頁面:

<apex:page > 
    <script type="text/javascript"> 
     window.close(); 
    </script> 
</apex:page> 

然後重定向(由JavaScript或頂點PageReference)頁面。

0

馬修,我想有一個更簡單的方法。 您可以這樣做: 1.創建一個調用保存方法 2.創建一個調用此動作函數的JS方法,然後調用窗口上的close() 3.在onClick屬性中從點調用JS方法2.

瞧! :)