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
tgganeshtgganesh 

Checkbox in visualforce

Hi all,

 

        Can anyone help me in using Checkbox in visualfoce, am new to visualforce,

I have three checkbox, The value selecting in a checkbox should be stored in a custom object and whenever i open the page again.. the selected value should retrive from the custom object and display the checkbox selected.

 

I want to use the <apex:inputCheckbox tag..

 

Please give me some idea...

bolaurent.ax1262bolaurent.ax1262

tgganesh, if you have a custom object named "my_custom_object__c" and it has custom field "my_custom_field__c" which is defined as a checkbox, then you just use the inputfield tag. VF "knows" that it should generate a checkbox, and the proper label.

 

<apex:page standardController="my_custom_object__c">
  <apex:form id="theForm">
    <apex:pageBlock title="Enter Lead" mode="edit">
      <apex:pageBlockButtons>
        <apex:commandButton value="Save" action="{!save}"/>
      </apex:pageBlockButtons>
      <pageBlockSection>
        <apex:inputField value="{!my_custom_object__c.my_custom_field__c}"/>
      </pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>