Unlike for components such as apex:selectList, apex:inputText etc., apex:inputField doesn't provide a Disabled attribute which is unfortunately exactly what I need right now. Could there be any alternatives here?

I need an inputfield to remain disabled until a value in selectList != '--None--'. How can I achieve this if, in the code below, I were to replace apex:inputText with apex:inputField . This code is TWO steps away from my need i.e. it uses inputText and when the page loads Name is still not disabled even though selectlist has "--None--" as value.

enter image description here

Any insights/help will be greatly appreciated. Thanks!!

2 Answers 2


In your VF page, use both components, inputField and outputField with opposite rendering condition. What you have to pay attention to is to update the components everytime an action specified in actionSupport is called. You can do so by wrapping both inputField and outputField components in an outputPanel and specifying the outputPanel's ID as the element to rerender on actionSupport's finish.

<apex:selectList id="birthPlace" value="{!birthPlace}">
    <apex:selectOption itemLabel="--None--" itemValue="none" />
    <apex:selectOption itemLabel="Poland" itemValue="pld" />
    <apex:selectOption itemLabel="Europe" itemValue="erp" />
    <apex:actionSupport event="onchange" action="{!boolChange}" rerender="nameFields" />
<apex:outputPanel id="nameFields">
    <apex:outputField label="Name" value="{!Chopin}" rendered="{!pianoBool}" />
    <apex:inputField label="Name" value="{!Chopin}" rendered="{!NOT(pianoBool)}" />

Hope it helps!


You could use two elements with a render statement that switches them. When your selectlist is none you render and output field with your value (which will appear as read only). When your select is populated, render an inputfield version and nice the output field version.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .