I am defining a class for a TR tag based on some condition. This works fine if there is a if and else situation

<tr class="{!IF(ISNULL(Eslot.sEvent), 'Free', 'Fill')}">

Now i have a third option, ie if Eslot.sEvent has some value , then i need to check if that event has a type = 'Personal' and if its is then need use the class called 'Pers' else use Fill.

I tried something like this

 <tr class="{!IF(ISNULL(Eslot.sEvent), 'Free', if(Eslot.sEvent.Appointment_Type__c=='Personal','Pers',Fill'))}">

It gives out an error

    Error: EL Expression Unbalanced:

Any idea how to resolve this? This code already existing piece of code, so i want to do as less logic changes as possible

  • 3
    You might want to consider moving the logic to a single method in the controller that returns a String as expressions get more complicated in VF pages, they become harder to maintain and more error prone (as you found out), in my opinion. – Peter Knolle Nov 28 '13 at 13:50

You are missing an opening quote in Fill'. It should be:

<tr class="{!IF(ISNULL(Eslot.sEvent), 'Free', IF(Eslot.sEvent.Appointment_Type__c == 'Personal', 'Pers', 'Fill'))}">

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.