I faced an issue with <apex:inputText> while using disabled attribute with it.

The scenario is i can disable and enable the <apex:inputText> using a checkbox.

<apex:inputText> is binded with an Integer variable.

But when i enable the


i get error : element value must resolve to a String type!

I tried these workarounds given in this post apex:inputText disabled binding causing "element value must resolve to a String type!"

But the above workarounds changes the appearance , the goal is not achievable.

When i tried binding <apex:inputText> with String , the functionality worked fine , however now i have to make use of Integer.valueOf(myStringVariable) everywhere i need to do calculations in my code.

I just want to know the reason behind this error element value must resolve to a String type!

Why this doesn't work with integer value.

3 Answers 3


This looks to be a bug in Visualforce - its been around since 2008 by the look of this post on the Developerforce Discussion Boards:


The best I've been able to do with this is to have the underlying property still stored as an Integer, but have a string based getter/setter for it that converts to/from a string. That way I can use the property as an Integer within my code and I just have to convert it once.

You'll need an answer from Salesforce as to why it works this way - given that people have been complaining about this behaviour for nearly 6 years, it feels like they might think its working correctly. Although Doug Chasman does suggest its a bug in the developerforce post above.

  • hit this today. Seems as long as the property uses {get;set} and is not assigned a value in the controller you are fine. But as soon as you do say prop = 1 like in the constructor the error is thrown. Wierd how empty getter and setter work but assign a number to it and bam, broke
    – Eric
    Dec 15, 2016 at 6:06

BTW, immediate="true" fix this problem for me.


Use outputText instead of disabled:

<apex:outputText id="test1" value="{!item.Number}" rendered="{!item.isallowed}"/>

This worked for me. Hope this is helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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