1

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')}"

  • 2
    What have you tried so far? Have you ever used formula functions that work also in Visualforce? Looks like this one is a candidate for CONTAINS, possibly also with TEXT if they're picklists. – eyescream Jun 5 '13 at 7:19
  • Maybe you could post some code? – Sergej Utko Jun 5 '13 at 7:19
  • Yes I have a picklist where I have want to disable checkbox whose values is in that picklist. My problem is as I am using contains If In my picklist If values are NRP then both N and NRp records checkboxes are disabling.If I select N then it is behaving properly. I want to understand what should I do.? – Arun SFDC Jun 13 '13 at 8:33
  • See here spec is picklist where It has NRP,N rendered="{!if(contains(spec,doc.acc.Specialization__c),'false','true')}" – Arun SFDC Jun 13 '13 at 8:38
1

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

| improve this answer | |
  • Thanks for that, 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')}" – Arun SFDC Jun 13 '13 at 8:38

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.