You need to sign in to do that
Don't have an account?
hacksawblade16
attach checkboxes to custom object field
can yanyone tell me how can i display the fields of custom object on vf page along with checkboxex attached to each field.Can i use param and assign to for this??if yes can anyone show me an example
If the field in the object is of Checkbox Datatype, you can use <apex:inputField> or <apex:outputField> for input and output resp. Else, if you want to show custom checkbox then you can use <apex:inputCheckbox>
E.g:
<apex:inputCheckbox value="{!checkboxValue}"/>
//Apex Code
public Boolean checkboxValue{get;set;}
Hi ,
I could not understand the proper requirement But the solution is in Wrapper class.
Create a wrapper class like
Make a list of type List<Wrapper> listOfWrapper; and iterate this list on VF page like :
Hence by the wrapper class you can bind the check box value to the field.
If this could not help you please provide me proper requiremt ,Will provide you appropiate result.
this is the format in which it must be on the Vf page
first name last name company
radiobutton1) jack sparrow infosys-------:>(prospect) lead record
radiobutton2) jack mathews salesforce----->matching people record based on first name of prospect(lead) record
radiobutton3) jack fernandes IBM -------------->matching people(contact) record based on first name
- -
- -
- -
- -
-radiobutton n) record n
Hi,
I think Wrapper Class will help you to achieve this. Please get the basics of Wrapper Class.
I will try to give you the logic
class ParentWrapper{
//This class is used to show the Lead(Prospect) record
public List<ChildWrapper> peopleList{get;set;}
public Boolean radioButton{get;set;}
public Lead prospectRecord{get;set;}
}
class ChildWrapper{
public Contact singleContact{get;set;}
public Boolean radioButton{get;set;}
}
List<ParentWrapper> pList=new List<ParentWrapper>();
List<Lead> mainList=[SOQL];
for(Lead temp:mainList)
{
List<Contact> conList=[SELECT FirstName,LastName WHERE FirstName LIKE temp.FirstName];
List<ChildWrapper> cList=new List<ChildWrapper>();
for(Contact c:conList)
{
ChildWrapper tempCW=new ChildWrapper();
tempCW.singleContact=c;
cList.add(tempCW);
}
ParentWrapper tempRecord=new ParentWrapper();
tempRecord.prospectRecord=temp;
tempRecord.peopleList=cList;
}
//VF Page
You can use nested repeat
<apex:repeat value={!pList} var="p">
<tr>
<td><apex:selectRadio/></td>
<td>FirstName</td>
<td>LastName</td>
</tr>
<apex:repeat value={!p.peopleList} var="c">
<tr>
<td><apex:selectRadio/></td>
<td>FirstName</td>
<td>LastName</td>
</tr>
</apex:repeat>
</apex:repeat>
I hope it helps. Please mark it as solution if it solves your issue.