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
mallikharjunarao gundamallikharjunarao gunda 

select the checkbox disable the fields

HAi hallll
I need to  enable  the fields if i select the checkbox ,if i deselect the checkbox  dissable the fields how cani i do that please let me now
satyaprakash palsatyaprakash pal
Using javascript we can enable and disable the fields
Martijn SchwarzerMartijn Schwarzer
Hi mallikharjunarao gunda,

Please find below a simple example of how to create this using only Visualforce:

My VF Page:
<apex:page standardcontroller="Account" extensions="myAccountExtension">
    <apex:form id="myForm">
        <apex:pageBlock title="Enable/Disable fields on checkbox (de)selection demo">
            <apex:pageblockSection title="Toggle to enable/disable" columns="1">
                    <apex:outputLabel>Toggle me</apex:outputLabel>
                    <apex:inputCheckbox value="{!isEditable}">
                         <apex:actionSupport event="onchange" rerender="myForm" status="myStatus"/>
                <apex:actionStatus id="myStatus" startText="Re-rendering form..."/>
            <!-- Section with editable fields -->
            <apex:outputPanel rendered="{!isEditable}">
                <apex:pageblockSection title="Account Info" columns="1">
                    <apex:inputField value="{!Account.Name}"/>
                    <apex:inputField value="{!Account.Description}"/>
            <!-- Section with read-only fields -->
            <apex:outputPanel rendered="{!NOT(isEditable)}">
                <apex:pageblockSection title="Account Info" columns="1">
                    <apex:outputField value="{!Account.Name}"/>
                    <apex:outputField value="{!Account.Description}"/>

And a very simple Apex Extension class to hold the value of the Checkbox:
public class myAccountExtension {
    public Boolean isEditable{get;set;}
    public myAccountExtension(ApexPages.StandardController controller){
I hope this helps!

Best regards,
Martijn Schwärzer

Ps. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
mallikharjunarao gundamallikharjunarao gunda
dont go to the apex class through configuration only how can i do that