Find your content:

Search form

You are here

inputText Syntax Error - missing ')'

 
Share

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?


Attribution to: George S.

Possible Suggestion/Solution #1

Just a heads up, I got the same error when attempting to put a function into the value attribute of the apex:column element. That is not allowed, and instead you should put the function into the value attribute of the apex:column's parameter:

<!-- WRONG -->
<apex:column value="{!RIGHT(line.name, 5)}"/>

<!-- RIGHT -->
<apex:column>
  <apex:outputText value="{!RIGHT(line.name, 5)}"/>
</apex:column>

Attribution to: Kirill Yunussov

Possible Suggestion/Solution #2

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)}"/>

Attribution to: jordan.baucke
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/2085

My Block Status

My Block Content