6

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

1
  • 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. Commented Nov 28, 2013 at 13:50

1 Answer 1

12

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .