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
Mayank BatraMayank Batra 

How to link apex:inputCheckbox to a String or Object property on selection.

Hi,

I am displaying my Object's fields to the users like below. I have given a checkbox against each value. On click of submit, I want to use the selected values only and use them (say save to the DB).

User-added image

Following is the apex code :
 
              <apex:pageblockTable value="{!filteredReq}" var="req"  >
                    <!--<apex:pageBlockTable value="{!FG_Business_Requirement__c}" var="c" id="table1"/> -->
                    <!-- <apex:column >-->
                    <!--   <apex:param value="{!req.BR_Number__c}" assignTo="{!currentReqNum}" />-->
                    <!--    <apex:selectCheckboxes value="{!brNumbers}">-->
                    <!--       <apex:selectOptions value="{!reqItems}" />-->
                    <!--   </apex:selectCheckboxes>-->
                    <!--  </apex:column>-->
                    
                    <apex:column >
                        <apex:param value="{!req}" assignTo="{!reqList[count].con}" />
                        <!-- <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>-->
                        <apex:inputCheckbox value="{!selected}" />
                    </apex:column>
                    <apex:column style="text-align: justify;" value="{!req.BR_Number__c}"/>
                    <apex:column style="text-align: justify;" value="{!req.Name}"/>
                    <apex:column style="text-align: justify;" value="{!req.FG_id__c}"/>
                    <apex:column style="text-align: justify;" value="{!req.BR_Complexity__c}"/>
                    <apex:column style="text-align: justify;" value="{!req.Tech_Complexity__c}"/>
                    <apex:column style="text-align: justify;" value="{!req.BSRQ_Process__c}"/>
                    <apex:column style="text-align: justify;" value="{!req.BSRQ_Process_Group__c}"/>
                    <apex:column style="text-align: justify;" value="{!req.BSRQ_SubProcess__c }"/>
                    
                    <apex:param value="{!++count}" assignTo="{!count}"/>
                </apex:pageblockTable>
                <apex:commandButton value="Submit" action="{!submit}" dir="LTR"/>

Can anybody tell me if there is a way I can link the checkbox with an Object or even a String that will help me get hold of the selected list and then submit the selected values only?

Thanks,
Mayank Batra


 
Best Answer chosen by Mayank Batra
Nayana KNayana K
https://developer.salesforce.com/page/Wrapper_Class

All Answers

Nayana KNayana K
https://developer.salesforce.com/page/Wrapper_Class
This was selected as the best answer
Mayank BatraMayank Batra
Thanks for the link Nayana.. Fixed like a charm.