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
rajubalajirajubalaji 

how to write a apex class for checkbox functionatlity

Hi everyone,

I am new to salesforce developer domain.Please help me for futher process.

please find the below visual force page here i need to create apex class for the check box functiontality.please guide me.

    <apex:pageBlockSection columns="1" id="block1" title="Deactivation List" collapsible="false">
                    
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="CSV File : "/>
                            <input type="file" name="files[]" multiple="multiple" onchange="prepareFiles(this);"/>
                       </apex:pageBlockSectionItem>
                    
                    <apex:pageBlockSectionItem>
                        <apex:outputLabel value="Deactivation Reason: "/>
                        <select Id="ddlDeactivationReason">
                            <option value="-1">--None--</option>
                            <option value="4">Access code &#38; send email</option>
                            <option value="1">Access code &#38; suppress email</option>
                            <option value="3">Invitation link &#38; send email</option>
                            <option value="2">Invitation link &#38; suppress email</option>
                            <option value="5">Eligibility Verification</option>
                        </select>
                    </apex:pageBlockSectionItem>
                
                      <apex:pageBlockSectionItem>Suppress Email:
                          <apex:inputCheckbox/>
                    </apex:pageBlockSectionItem>     

         </apex:pageBlockSection>            
        </apex:pageBlock>
please help to create apex class controller for this class with explaination.

thanks in advance
Best Answer chosen by rajubalaji
Ajay K DubediAjay K Dubedi
Hi Balaji,

Use the below code for checkbox functionality. 

----VF page----
<apex:page Controller="ForCheckbox">
    <apex:form>
        <apex:actionRegion>
            <apex:inputCheckbox id="user" value="{!status}">
                <apex:actionSupport  event="onclick" reRender="sslob" action="{!hideDisplayLOB}"/>
            </apex:inputCheckbox>   
        </apex:actionRegion>
    </apex:form>
</apex:page>
----Apex Controller--------
public class ForCheckbox {
    public Boolean status{get;set;}
    public void hideDisplayLOB()
    { 
       // Do Somthing here...
        system.debug('Status--->>'+status);
    }
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com