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
Leena.devLeena.dev 

have to get values of checkbox from vf to custom object

Hi all,on vf page,iam having 4 checkbox, as
[].a)salesforce
[].b)sap
[].c)oracle
[].d)siebel
[].e)ibm
[].f)cloud
when ever checkbox like a,f are checked , only a) and f) should go to my custom object as A,F ..so 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..

Ajay_SFDCAjay_SFDC
Hi ,

If you dont want to use wrapper class then i think you have following way to workaround :

Create a custom field with Text datatype and Name it is SelectedChkBoxes 

Then in your controller you can do this :

strselectedChkBoxValue ='';

In your save method :

if(Suppose all chk boxes are checked)
{
  strselectedChkBoxValue = 'A,B,C,D,E,F'
} else if(Suppose first is checked and others are false)
  strselectedChkBoxValue ='A';
} else if()
/*
  Structure for all the possible conditions
*/

For compairing you can query on that field :
String strinsertedVal ;

public Account obj =[select strselectedChkBoxValue from Account where Id : your Id  LIMIT 1];

strinsertedVal = obj.strselectedChkBoxValue ;

if(strinsertedVal.contains(',')) List <String> lstChkValues = strinsertedVal.split(','); //By this way you will get the multiple options

Then you can iterate on lstChkValues for options .

Thanks