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
Sujata Tiwari 3Sujata Tiwari 3 

Need help in hiding the button in Visualforce page

Hi,

I want to display my Start button at first and when the user clicks on it then display ShowProducts button.
My Vf page :
<apex:page standardController="Lead" extensions="TrialReController" sidebar="false" showHeader="false">
<apex:form id="frm">
<apex:pageblock>
<apex:pageblockButtons location="bottom">
   <apex:commandButton value="Start" action="{!start}" rendered="{!x}" />
    <apex:commandButton value="ShowProducts" action="{!ShowProducts}" rendered="{!y}" />
</apex:pageblockButtons>

</apex:pageblock>
</apex:form>
</apex:page>
***************************************
public class TrialReController {
    public boolean x{get;set;}
    public boolean y{get;set;}
    public TrialReController(ApexPages.StandardController controller) {

    }
    public void start(){
        x=true;
        check();
    }
    public void ShowProducts(){
        y=true;
        check();
    }
    public void check(){
        if(x == true){
            y=false;
        }
        else{
            x=false;
        }
    }
}

When I am previewing my output I can't see any button there.
Many thanks for your help.!!
Ayush TripathiAyush Tripathi
Refer this code
 
public class TrialReController{
    public boolean x{get;set;}
    public boolean y{get;set;}
    public TrialReController(ApexPages.StandardController controller) {
		x = true;
    }
    public void start(){
        x=true;
        check();
    }
    public void ShowProducts(){
        y=true;
        check();
    }
    public void check(){
        if(x == true){
            y=true;
        }
        else{
            x=false;
        }
    }
}

 
Ayush TripathiAyush Tripathi
Hi Sujata

Is your query solved.if yes mark this thread closed.