[SalesForce] Disable Checkbox in pageblocktable

I am looking to disable checkbox based on matching value in field of "rep type" which is in User object and a field of "Doctype" which is in Account object

for example:

Reptype is red and Doctype values are Red,Yellow, Red + yellow.

Now I am trying to disable chechbox where Reptype field value matching values in Doctype
In this case , checkbox disabled for red and Red + yellow.

I know we can use disabled attribute where we can different combination to disable. But I want to get dynamically by matching values in both fields.

Please let me know If anyone have any difficulty in understanding.

Added from comment below:

Now my scenario is I need to disable from picklist values. Here is my
sample code.See here spec is picklist where It has NRP,N

rendered="{!if(contains(spec,doc.acc.Specialization__c),'false','true')}"

Best Answer

Supposing that your visualforce page has an object called "o" related to User and Account you should try something like this:

<apex:inputCheckbox disabled="{!!CONTAINS(o.account.Doctype,o.user.Reptype)}" value="{!o.checkbockFieldName}" /> 

Take a look of this samples of advanced use of formulas

Related Topic