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 

get the values of checkbox if only checked into another object

Hi all,on vf page,iam having 4 checkbox, as
when ever checkbox like a,f are checked , only a) and f) should go to my custom object as A,F after i need to compare it with correct answer which is in other object as A,F,,HOW TO COMPARE IT?? Am not gud in wrapper class,can any one help me to move..


Hi Leena,


Please go through below link which contains the example and usage of Wrapper class :-

Hi thanx vinit, but i Already have that,its not making move as iam new in coding

Thiyagarajan SelvarajThiyagarajan Selvaraj



You can do this with the following code




public with sharing class applications {
    String[] applications = new String[]{};
      public String[] getcrmAppplications() {
        return applications;
    public void setcrmAppplications(String[] applications) {
        this.applications = applications;
    public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('A','a) salesforce'));
        options.add(new SelectOption('B','b) sap'));
        options.add(new SelectOption('C','c) oracle'));
        options.add(new SelectOption('D','d) siebel'));
        options.add(new SelectOption('E','e) ibm'));
        options.add(new SelectOption('F','f) cloud'));

        return options;
    public PageReference saveOptions() {
        String selectedField;
        for (String field : getcrmAppplications()){
            selectedField = selectedField == null ? field : +selectedField+','+field;
        System.debug('Fields are '+selectedField);
        // Output as A,B,C based on the selected fields
        // i assume object and field Names
        for (Test_Object__c ans : [SELECT correctAnswer__c FROM Test_Object__c  LIMIT 5000]){
            if (ans.correctAnswer__c == selectedField){
                // Your logic here
        return null;




<apex:page controller="applications" >
    <apex:form >
        <apex:selectCheckboxes value="{!crmAppplications}" title="Choose">
            <apex:selectOptions value="{!items}"/>
        <apex:commandButton value="Save" action="{!saveOptions}" />

Thanks a lot ,,,but was not getting.


if suppose user selected checkbox A& F(choosed checkbox) which iam storing it in a custom object(choosed option__c) now i need to compare it with correct answer__c object as A;F(correct answers).if both matches need to count .how i need to this? how to give result (marks)as pdf with all questions and answers????


Thanx in advance for your kind help..!!!