How can I get the values on a pageblocktable with a checked checkbox on the side like this? Thanks in advance.

enter image description here


You need to use Action support.

Onclick of checkbox call a method and assign student record id to any variable

And in controller method iterate over the list and check which selected Id and student Id if matched. Means you have selected that row.

<apex:inputCheckbox value="{!student.IsActive__c}">
    <apex:actionSupport event="onclick"
        <apex:param id="student" name="studentId" value="{!student.Id}"


public Id objSelectedStudentId {get;set;}

public void handlestudentCheckboxChange()
    for(Student__c objStudent: lstStudent)
       if(objStudent.Id == objSelectedStudentId)
          system.debug('-----This is the selected student record----'+objStudent);
  • @gelay is this issue resolved.
    – Ratan Paul
    Feb 16 '16 at 10:36
  • no, the message is not showing.. i used apexPages.addmessage(new ApexPages.message(Apexpages.severity.error, teacher)); Feb 17 '16 at 1:48
  • @gelay Sorry I can't see in your question you have asked anything related to apexPages.addmessage(new ApexPages.message(Apexpages.severity.error, teacher));
    – Ratan Paul
    Feb 17 '16 at 2:13
  • @gelay what is the issue you are facing. Let me know if I can help you.
    – Ratan Paul
    Feb 17 '16 at 2:20
  • i mean, sample, if the student is in the objSelectedStudentId, there will be displayed a message on the VFP. i used apePages.addmessage but it is not showing. Feb 17 '16 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.