function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RICARDO PALMARICARDO PALMA 

Pop-up Box Three Buttons

Hi,
Clicking custom button in a visual force page, I would like to call a confirmation pop-up box message with three buttons(Ye, No, Cancel). Is there any way to do it.
Clicking Yes call controller test1
Clicking No call controlles test2
Clicking Cancel stay on the same page.

Thanks 
Best Answer chosen by RICARDO PALMA
KaranrajKaranraj
Ricardo - You can create pop-up window using Visualforce page.

Apex class
public class popupWindow {     

    public boolean displayPopup {get; set;}     
    
    public void closePopup() {        
        displayPopup = false;    
    }     
    public void showPopup() {        
        displayPopup = true;    
    }
    
  }

Visualforce
 
<apex:page controller="popupWindow">
    <apex:form >
        <apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="tstpopup"/>
        <apex:pageBlock >
            This is just filler text from the Salesforce General. 
        </apex:pageBlock>
 
        <apex:outputPanel id="tstpopup">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
                Your Popup window.<br/><br/><br/>
                <apex:commandButton value="Cancel" action="{!closePopup}" rerender="tstpopup"/>
                <apex:commandButton value="Yes" action="{!closePopup}" rerender="tstpopup"/>
                <apex:commandButton value="No" action="{!closePopup}" rerender="tstpopup"/>
            </apex:outputPanel>
        </apex:outputPanel>
 
    </apex:form>
 
    <style type="text/css">
        .custPopup{
            background-color: white;
            border-width: 2px;
            border-style: solid;
            z-index: 9999;
            left: 50%;
            padding:10px;
            position: absolute;
            /* These are the 3 css properties you will need to change so the popup 
            displays in the center of the screen. First set the width. Then set 
            margin-left to negative half of what the width is. You can add 
            the height property for a fixed size pop up if you want.*/
            width: 500px;
            margin-left: -250px;
            top:100px;
        }
        .popupBackground{
            background-color:black;
            opacity: 0.20;
            filter: alpha(opacity = 20);
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 9998;
        }

    </style>
</apex:page>

In the visualforce page add exestions, if you want to extend the functionlaity of controller class and those extension method can be called from the button. Fore more details check this post -http://www.salesforcegeneral.com/salesforce-modal-dialog-box/

Thanks,
Karan

All Answers

Shrikant BagalShrikant Bagal
@Ricardo,

Might this help you:
http://www.salesforcegeneral.com/salesforce-modal-dialog-box/
KaranrajKaranraj
Ricardo - You can create pop-up window using Visualforce page.

Apex class
public class popupWindow {     

    public boolean displayPopup {get; set;}     
    
    public void closePopup() {        
        displayPopup = false;    
    }     
    public void showPopup() {        
        displayPopup = true;    
    }
    
  }

Visualforce
 
<apex:page controller="popupWindow">
    <apex:form >
        <apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="tstpopup"/>
        <apex:pageBlock >
            This is just filler text from the Salesforce General. 
        </apex:pageBlock>
 
        <apex:outputPanel id="tstpopup">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
                Your Popup window.<br/><br/><br/>
                <apex:commandButton value="Cancel" action="{!closePopup}" rerender="tstpopup"/>
                <apex:commandButton value="Yes" action="{!closePopup}" rerender="tstpopup"/>
                <apex:commandButton value="No" action="{!closePopup}" rerender="tstpopup"/>
            </apex:outputPanel>
        </apex:outputPanel>
 
    </apex:form>
 
    <style type="text/css">
        .custPopup{
            background-color: white;
            border-width: 2px;
            border-style: solid;
            z-index: 9999;
            left: 50%;
            padding:10px;
            position: absolute;
            /* These are the 3 css properties you will need to change so the popup 
            displays in the center of the screen. First set the width. Then set 
            margin-left to negative half of what the width is. You can add 
            the height property for a fixed size pop up if you want.*/
            width: 500px;
            margin-left: -250px;
            top:100px;
        }
        .popupBackground{
            background-color:black;
            opacity: 0.20;
            filter: alpha(opacity = 20);
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 9998;
        }

    </style>
</apex:page>

In the visualforce page add exestions, if you want to extend the functionlaity of controller class and those extension method can be called from the button. Fore more details check this post -http://www.salesforcegeneral.com/salesforce-modal-dialog-box/

Thanks,
Karan
This was selected as the best answer
RICARDO PALMARICARDO PALMA
Karan and Shrikant, 
I can't thank you guys enough. I created a case on Salforece asking about it but they couldn't help me. The Sf guy told that it was't a way to do it.

Thanks again.