I have a pageblock with 2 columns and a checkbox column in Apex:repeat. Im trying to select the whole by selecting the checkbox. when I select the checkbox, the value is not being captured. Yes im using the wrapper class as per the salesforce example.

In my class, the list "selectedEngs" is empty. To this list, Im adding the selected rows. But the size is zero, even after checkbox is ticked.

Did I miss anything, below is my code. Please let me know.

Here is the vf PAGE. 1 text field and checkbox.

<apex:repeat value="{!Engagements}" var="item"> 
    <apex:pageBlockSection id="Selected_PBS" columns="3" >
        <apex:outputPanel layout="block">
            <apex:outputText value="{!item.eng.Program__c}"/>

        <apex:outputPanel layout="block">                              
            <apex:inputCheckbox value="{!item.selected}" id="checkedone">
                <apex:actionSupport event="onClick" action="{!applySelectedFlags}"/>                                             

Apex class is below

List <Engagement__c> selectedEngs = new list<Engagement__c>();
List<EngagementWrapper> engList = new List<EngagementWrapper>();

public PageReference applySelectedFlags()
    for(EngagementWrapper engwrapper : engList)
        if(engwrapper.selected == true)
    return null;

public List<EngagementWrapper> getEngagements()
    for(Engagement__c e : studentList)
        engList.add(new EngagementWrapper(e));

    return engList;

public List<Engagement__c> GetSelectedEngs()
        return selectedEngs;
        return null;



  • Where is studentList? Can you check studentList size? May 4, 2014 at 7:31
  • StudentList is the list of records Im displaying in the page. Yes the size is 1.
    – sfdcFanBoy
    May 5, 2014 at 0:06

1 Answer 1


By setting rendered=false on the apex:actionSupport you are effectively turning that feature off. Remove that and the getSelected method will be invoked when a checkbox is clicked.

By the way, the get method prefix is one way of exposing properties to the Visualforce page, but action methods can be called whatever you like. So getSelected might be better called something like applySelectedFlags - clear naming generally makes code easier to follow.

  • I have set this to false because everytime I tick the checkbox, the page (or pageblock) refreshes and checkbox is getting unchecked immediately !!
    – sfdcFanBoy
    May 5, 2014 at 0:09
  • I have made the following changes per your suggestions. Still the list is empty, nothing is getting selected. 1) I have changed the Action method name from getSelected to "applySelectedFlags". 2) Also removed "rendered=false" from the actionSupport. 3) I also changed the actionSuppport event from "onclick" to "onClick". This change stopped the unusual behavior of checkbox being unchecked automatically.
    – sfdcFanBoy
    May 5, 2014 at 3:46
  • @BruceLee I took your page and controller and got them working using Contact instead of your Engagement__c object with just the rendered change. Use your browser's "Developer Tools" to check that the click results in a request to the server and use the debug logs in your org to check what happens there.
    – Keith C
    May 5, 2014 at 9:17
  • the problem is with this. if(engwrapper.selected == true).. this is not being set to true even after I select the row..
    – sfdcFanBoy
    May 5, 2014 at 11:33
  • @BruceLee Unless your wrapper is broken (unlikely but you didn't post its code) I don't know what the problem is. All I can suggest is that you do lots of step by step debugging.
    – Keith C
    May 5, 2014 at 12:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .