I can't figure out what it is I am doing wrong with this code. I would like to only render the Service_Account__c.CM_Service__c field based upon the value of the checkbox field Service_Account__c.To_be_used__c.
As it is now, the CM_Service__c field will never render, regardless of what values I put into the logic true or false.
<apex:pageblocksection title="Settings (If Applicable)" showheader="true" columns="1" >
<apex:inputfield value="{!Service_Account__c.To_be_used__c}" required="false">
<apex:actionSupport event="onchange" reRender="SERV" />
</apex:inputField>
<apex:inputfield id="SERV" value="{!Service_Account__c.CM_Service__c}" required="false" rendered="{IF(!Service_Account__c.To_be_used__c == true,true,false)}" />
</apex:pageblocksection>
Any ideas ? Is it just a syntax error I'm not catching…?
Best Answer
You need to rerender the parent element with conditionally rendered elements
And your rendered attribute can be shortened to just the field value (also fixing the improper
IF
which was written incorrectly but was not needed anyway)