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.

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

<apex:inputText>

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.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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

https://developer.salesforce.com/forums/ForumsMain?id=906F0000000951yIAA

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.

share|improve this answer
add comment

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.