[SalesForce] apex:inputText disabled binding causing “element value must resolve to a String type!”

Within my Visualforce page I'm binding to a boolean property in a controller subclass to disable a apex:inputText control.

Page Extract:

<apex:inputText id="impressions" value="{!drop.impressionsRequested}" 
    disabled="{!dropObj.impressionsDisabled}" />

Controller subclass Extract:

public with sharing class AddDropController {
    //...
    public virtual class Drop implements Comparable {
        //...

        // Should the user be able to enter impressions?
        public boolean impressionsDisabled { get; set;}

        //...
    }
    //...
}

The page seems to load fine and the text input is disabled, but when I submit back via a command button I get an error in the page Messages:

element value must resolve to a String type!

element value must resolve to a String type!

The VF_PAGE_MESSAGE appears in the log file when the sub class properties are being assigned:

VF_PAGE_MESSAGE added when setting properties

If I remove the disabled attribute binding from the Visualforce markup the error does not occur.

Is there something I'm missing about binding to the disabled attribute?

Best Answer

Can you just use outputText instead if it needs to be disabled? Not the same appearance but might work for you?

<apex:outputText id="impressions" value="{!drop.impressionsRequested}" rendered="{!dropObj.impressionsDisabled}"/>

<apex:inputText id="impressions" value="{!drop.impressionsRequested}" rendered="{!NOT(dropObj.impressionsDisabled)}"/>

Or instead out output text you could just use a disabled HTML input element so it would maintain the same look:

<apex:outputPanel layout="none" rendered="{!dropObj.impressionsDisabled}">
    <input type="text" value="{!drop.impressionsRequested}"/>
</apex:outputPanel>