As we have disabled attribute in <apex:inputCheckbox> cant we use same field in input type checkbox as formula. I am trying to use as below but disabled attribute is not working for me. Is there any syntax error or workaround. I need to use Input type checkbox only.

<apex:inputCheckbox id="{!dev.Deviation_Id__c}" styleclass="slds-input" 
        disabled="{!IF(dev.Priority__c == deviationLevel,'false','true')}"

<input type='checkbox' id="{!dev.Deviation_Id__c}" class="slds-input"
onchange="checkedDeviations('{!dev.Deviation_Id__c}')" disabled="{!IF(dev.Priority__c == deviationLevel,'false','true')}"/>
<apex:inputCheckbox id="{!dev.Deviation_Id__c}" styleclass="slds-input" 
        disabled="{!dev.Priority__c != deviationLevel}"

The disabled and rendered attributes expect Boolean values, so this should do the trick.

  • First of all i want to use in Input type checkox and deviationLevel is value being passed from controller to Vf not string so i must use if i suppose – Deepak Agarwal Feb 11 at 17:02
  • And in apex:inputCheckbox id="{!dev.Deviation_Id__c}" is not working since its not taking dynamic values. – Deepak Agarwal Feb 11 at 17:12
  • @DeepakAgarwal, we can not set dynamic id attribute. The styleClass can be dynamic. And the expression used in disabled attribute of apex:inputCheckbox can also by used with Input type checkbox. This expression will evaluate itself as string comparison and return boolean value. You can try using an string property , I have updated the answer for this. – dev_skv Feb 12 at 9:48

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.