Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 5 down vote accepted

An easy and always work workaround:

<apex:outputPanel rerender="{!onOff}">
    <apex:inputField value="{!someField}"/>
</apex:outputPanel>
<apex:outputPanel rerender="{!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.

share|improve this answer

The reason is because this component responds to the read-only state of the field it is bound to (for example if the users profile does not permit editing of the field) via the value attribute.

Note: Read-only fields, and fields for certain Salesforce objects with complex automatic behavior, such as Event.StartDateTime and Event.EndDateTime, don't render as editable when using . Use a different input component such as apex:inputText instead.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.