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
srikanth cheera 13srikanth cheera 13 

visuforce 100

I have 2 pageblocks

firstone should be apper on the screen sencond should be hide mode.

after filling the data in first pageblock hide the first one and  second sholud be apper.

please help me.
Ajay K DubediAjay K Dubedi
Hi Srikanth,

I got your query.Please do follow the code below:

Vf page:

<apex:page controller="ShowHideController" showHeader="false" id="pg">
    <apex:form >
        <script>
        function hideme(value)
        { 
             var ca=value;
            console.log('>>>>'+ca);
            if(ca==''){

            }
            else
            {
                actionfun();
            }    
                
        }
        
        </script>
        <apex:actionFunction name="actionfun" action="{!hide}"/>
        
        <apex:pageBlock title="Block 1" rendered="{!hideblock}" id="pb" >
            Data for Block 1 &nbsp; <apex:inputText onclick="hideme(this.value);" label="data one" />     
        </apex:pageBlock>
        
        
        <apex:pageBlock title="Block 2" rendered="{!hidesecblock}"> 
            Data for Block 2 &nbsp; <apex:inputText label="data two" />
           
            <apex:inputText label="" />
              
        </apex:pageBlock> 
        
    </apex:form>    
    
</apex:page>


Controller Class:

public class ShowHideController {
    public Boolean hideblock{get;set;}
    public Boolean hidesecblock{get;set;}
    public ShowHideController()
    {
        hideblock=true;
        hidesecblock=false;
    }
    
    public void hide()
    {
        System.debug('java script');
        hideblock=false;
        hidesecblock=true;
    }
}

Hope this code will help you. Please mark it as best answer if you find it helpful.
Thanks.
Ajay Dubedi