4

I have an apex:inputText in wich I want the value to change when an Id is null or not null. I wrote that :

<apex:inputText value="{!IF(droitId!=null,droit.Oeuvre__r.Name,nomOeuvre)}"></apex:inputText>

(nomOeuvre is a variable I declared in my controller)

I tried with double quotes or simple quotes on the attributes, but I always get an error like "syntax error : value ')' missing ' or 'syntax error : value ' missing'

I was pretty sure that my syntax was right, and when I search for it, I found the same syntax than the one I use... If you have any idea about that kind of error, thank you for your answer :)

7

I believe the issue is you can't use expressions for the value attribute. From the VF developer's doc

A merge field that references the controller class variable that is associated with this field. For example, if the name of the associated variable in the controller class is myTextField, use value="{!myTextField}" to reference the variable.

so, you could do the following instead:

<apex:inputText value="{!droit.oeuvre__r.name}" rendered="{!droitId<>null}"/>
<apex:inputText value="{!nomoeuvre}" rendered="{!droitId=null}"/>
  • thank you, it's working this way, I'll keep your answer in mind ;) – dou Dec 21 '15 at 14:32

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.