[SalesForce] How to show/hide pageblock based on clicking a button in Visualforce using a standard controller

Here i have one Visualforce page and my situation is when i am clicking on Save Button both PageBlock will appearing but i want is : when i am click on Save the existing Pageblock should be hide and another Pageblock should be show..

is it possible ?

Can anyone tell me how i can do this ?

<apex:pageBlock >
        <apex:pageBlockButtons location="Bottom">
            <apex:commandButton value="Save" action="{!quicksave}" />
        </apex:pageBlockButtons>
               .
               .
    </apex:pageBlock>
    </apex:outputPanel>

    <apex:outputPanel>
    <apex:pageBlock >
        .
        .
    </apex:pageBlock>
    </apex:outputPanel>

Thanks

Best Answer

<apex:pageBlock rendered="{!NOT(isSaved)}">
    <apex:pageBlockButtons location="Bottom">
        <apex:commandButton rerender="pageblock-one" value="Save" action="{!quicksave}" />
    </apex:pageBlockButtons>
</apex:pageBlock>
.
.
.
<apex:pageBlock id="pageblock-one" rendered="{!isSaved}">
 ...
</apex:pageBlock>

Within your controller:

public PageReference quicksave() {
    // do some save stuff
    isSaved = true;
}
Related Topic