I have a list of Property_Rate__c records in an Apex:repeat function. For every record in the list, a checkbox is created. The value attribute of each checkbox is the ID of the Property_Rate__c record. I am wondering: When one of the checkboxes is checked, how to extract the ID value into a variable for later use?
<apex:repeat value="{!property_rate_list}" var="propertyRate" id="propertyRateList">
<input type="checkbox" value="{!propertyRate.Id}" class="dateCheckbox" onchange="verifyChecked($(this));" />
</apex:repeat>
verfiyChecked Function
$ = jQuery.noConflict()
function verifyChecked(checkbox)
{
$('.dateCheckbox:checked').prop('checked', false); // clear all checkboxes
$(checkbox).prop('checked', !$(checkbox).prop('checked')); // toggle
//changeDate($(checkbox).val());
}
Best Answer
We are going to use actionfucntion to pass value from visaulforce to controller.
I have defined inline comments. I hope it will help you to understand the code.
HTML update
Javascript update
Add following code before apex:form closing tag
Controller method