In Visualforce page, I am displaying the list of permissions as checkboxes.
<apex:selectCheckboxes layout="pageDirection" value="{!userPermission}">
<apex:selectOptions value="{!AllPermissions}"><br /></apex:selectOptions>
</apex:selectCheckboxes>
Here userPermission is a String variable and AllPermissions are the list of Permission__c object. It is displaying the list of all permissions. see the screenshot below : Now what i need to ask you is ,for example when any user clicks on "verify invoices" then "view invoice" options should automatically selected. how will i achieve this functionality over dynamically generated checkboxes.
How can i get to know id of selected checkboxes on the visualforce page at run time ? and how can i apply onselect function over specific checkbox ?
Followed the code steps :
Created the Developer__c field in the Permission__c Object with assigning some values to it.
Earlier I was adding the Id and PermissionName__c to the List but now I have added DeveloperID__c and PermissionName__c instead of ID.
List<SelectOption> listPermission = new List<SelectOption>(); for(Permission__c per : allPermissions) { listPermission.add(new SelectOption(per.DeveloperId__c,per.PermissionName__c)); } return listPermission;
Visual Force page code is same as above written
After rendering this page on the browser and developer id and name looks like
Now the problem is , how to get checkbox element in javascript so that i can apply some logic on particular permission checkbox. and Developer id is coming into value field, i want this developer field should become in "Id" attribute.
please reply as soon as possible.