1

I have create a command button on vf page. But Command button not getting display on Vf page.

My code

<apex:page controller="testpopup">
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockButtons>
                <apex:commandButton value="test" action="{!showpopup}" rendered="testpopup"></apex:commandButton>
            </apex:pageBlockButtons>
            <apex:pageBlockSection></apex:pageBlockSection>
        </apex:pageBlock>
        <apex:pageBlock>
        </apex:pageBlock>

        <apex:outputPanel id="testpopup">
            <apex:outputPanel styleClass="popupbackgroud" layout="block" rendered="{!displayPopUp}" />
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
                This is where I would put whatever information I needed to show to my end user.
                <br/>
                <br/>
                <br/>
                <apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="testpopup" />
            </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>

i am new in salesforce. Please let me know what is getting wrong .

1
  • Can you post your complete code. Along with the controller. PS: what is the output of displayPopUp() method? Commented Jun 27, 2014 at 19:44

1 Answer 1

1

You should check your controller and see if the value for "displayPopUp" has been set to false. You need to turn it to true in order to display the command button that is enclosed inside the outputPanel.

"rendered" attribute of outputPanel always take boolean values true/false.

<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
2
  • Thanks . it was issue related with rerender. so i remove rerender,its now working . Commented Jun 27, 2014 at 19:55
  • @user10160 Great. Good to hear that you solved the issue. Commented Jun 27, 2014 at 19:58

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.