You need to sign in to do that
Don't have an account?
U Jay
How can close current window on a button click after action in salesforce?
How can close current window on a button click after action in salesforce?
Have a button on a page layout in a tab.
When i click the button , will open a new visualforce page in new window.
When i click action button, have to close current window .
How can i achieve it?
Any help?
My current code :-
<apex:page controller="CommitteePositionRoleChangeController" showHeader="False">
<script>
function closeWindow() {
alert(1);
window.close();
}
</script>
<apex:form >
<apex:outputPanel >
<apex:outputText value="Select New Contact"/>
<apex:inputField value="{!positionCommitteService.Contact__c}"/>
<apex:commandButton value="OK" action="{!committeePositionRoleChangeAction}" rerender="statusMessagePanel" onComplete="closeWindow()"/>
</apex:outputPanel>
<apex:outputPanel id="statusMessagePanel">
<apex:pageMessages rendered="{!showStatusMessage}"/>
</apex:outputPanel>
</apex:form>
</apex:page>
Thanks in advance. :)
Have a button on a page layout in a tab.
When i click the button , will open a new visualforce page in new window.
When i click action button, have to close current window .
How can i achieve it?
Any help?
My current code :-
<apex:page controller="CommitteePositionRoleChangeController" showHeader="False">
<script>
function closeWindow() {
alert(1);
window.close();
}
</script>
<apex:form >
<apex:outputPanel >
<apex:outputText value="Select New Contact"/>
<apex:inputField value="{!positionCommitteService.Contact__c}"/>
<apex:commandButton value="OK" action="{!committeePositionRoleChangeAction}" rerender="statusMessagePanel" onComplete="closeWindow()"/>
</apex:outputPanel>
<apex:outputPanel id="statusMessagePanel">
<apex:pageMessages rendered="{!showStatusMessage}"/>
</apex:outputPanel>
</apex:form>
</apex:page>
Thanks in advance. :)
<apex:commandButton value="OK" action="{!committeePositionRoleChangeAction}" rerender="statusMessagePanel" onComplete="window.close();"/>
But it is not working for me :(
I suspect using rerender and onComplete together is creating trouble for you.
Try removing rerender.
and that must working fine then.
Link showeing is : https://cs8.salesforce.com/apex/CommitteePositionRoleChangePage?cID=a0gL00000012LvY
Title : Page editor - CommitteePositionRoleChangePage - Mozilla fire fox
And it should work in all browsers.
I have a doubt, whether we need to close it from where it is opened.?
I appeard when click a button on a tab.
I have another doubt :-
How can show an error message if a field in a tab is null near a button in the same tab on click it.othervice load a new url in a new window?
Tried with it too:-
<apex:commandButton value="OK" action="{!committeePositionRoleChangeAction}" onComplete="window.close();"/>
But same issue :( Not closing the same window :(
On the page which is opened call this javascript function as.