radio button


Example 1: radio buttons on VF page are used to set checkbox field type in the sObject

  1. <apex:page controller="testRadioController">
  2. <apex:form >
  3. <apex:selectRadio value="{!chosenOption}" >
  4. <apex:selectOptions value="{!items}"/>
  5. </apex:selectRadio>
  6. <apex:commandButton value="Commit" action="{!doSave}"/>
  7. </apex:form>
  8. </apex:page>


  1. public class testRadioController {

  2.     public PageReference doSave() {
  3.        return null;
  4.     }


  5. public List<SelectOption> getItems() {
  6. List<SelectOption> options = new List<SelectOption>();
  7. options.add(new SelectOption('True','True'));
  8. options.add(new SelectOption('False','False'));
  9. return options;
  10. }

  11. public String chosenOption {get;set;}

  12. public testRadioController (){}

  13. }



Comments

Popular Posts