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
SRILAKSHMI BSRILAKSHMI B 

displaying an input field after checking a checkbox on VF page

Hi All,

 

I have developed VF page where I have used standrad controller as well controller extension.

I have a requirement where upon clicking a checkbox on the VF page, user must be shown with one more input field to enter the value.

 

Can anyone please suggest how to show an input field on the VF page upon checking the checkbox.

 

Thanks,

Srilakshmi B

Best Answer chosen by Admin (Salesforce Developers) 
srikeerthisrikeerthi

Hi

 

You can do that in this way

 

VFpage:

<apex:page standardcontroller="Employee__c" extensions="Sample" > 

<apex:form >

       <apex:pageBlock id="SampleBlock"> 

        <apex:inputCheckbox id="isEmp" value="{!isChecked}" >   

          <apex:actionsupport event="onclick" rerender="SampleView" /> 

        </apex:inputCheckbox> 

                  <apex:outputPanel id="SampleView">       

      <apex:pageBlockSection rendered="{!isChecked}">     

            <apex:pageblockSectionItem >       

         Name <apex:inputtext value="{!Employee__c.name}"/>   

              </apex:pageblockSectionItem>              

                          </apex:pageBlockSection>                

      </apex:outputPanel>   

   </apex:pageBlock> 

</apex:form>

</apex:page>

 

Thanks