[SalesForce] inputText Syntax Error – missing ‘)’

I have an apex:inputText and I'm trying to set the initial value which the user can edit. It's a simple IF formula but it keeps giving me the error:

Syntax error. Missing ')'

Here's the line (when I remove it the error goes away):

<apex:inputText id="daysToCount" style="width: 30px;" value="{!IF(prefs != null && prefs.Recent_Interaction_Days__c != null, TEXT(prefs.Recent_Interaction_Days__c), '30')}"/>

What am I doing wrong?

Best Answer

Update

Move your binary operators into a 'rendered' attribute to determine which type of input you want to show, than flip the variables accordingly:

<apex:inputText id="daysToCount" style="width: 30px;" value=" TEXT(prefs.Recent_Interaction_Days__c)}" rendered="{!IF(prefs != null && prefs.Recent_Interaction_Days__c != null)}"/>
<apex:inputText id="daysToCount" style="width: 30px;" value="30" rendered="{!IF(prefs != null && prefs.Recent_Interaction_Days__c == null)}"/>
Related Topic