How can I make an apex:inputField disabled?

apex:inputField does not have an attribute called disabled.
How can I get an apex:inputField to be disabled?

Answer

An easy and always work workaround:

<apex:outputPanel rendered="{!onOff}">
    <apex:inputField value="{!someField}"/>
</apex:outputPanel>
<apex:outputPanel rendered="{!NOT(onOff)}">
    <apex:outputField value="{!someField}"/>
</apex:outputPanel>

With a {!onOff} variable and reRender behavior, the field behavior can be controlled just as you actually need.

Attribution
Source : Link , Question Author : phoenix7788 , Answer Author : Pittsburgh DBA

Leave a Comment