You need to sign in to do that
Don't have an account?
mustafatop
Using conditional statement in apex page
l get syntax error following line,
<apex:selectlist value="{!IF({!counter}={!1},{!selectedItem},{!selectedItem2})}" size="1">
How to use this formula functions in apex tags?
<apex:variable var="counter" value="{!1}"/> <apex:repeat value="{!events}" var="itr"> <br/><br/> <table> <tr> <td><apex:OutputText value="{!counter}"/></td> <td><apex:inputfield value="{!itr.Subject}" id="subject"/></td><td> <apex:inputfield value="{!itr.IsAllDayEvent}" id="day"/></td><td> <apex:inputfield value="{!itr.StartDateTime}" id="start"/></td><td> <apex:selectlist value="{!IF({!counter}={!1},{!selectedItem},{!selectedItem2})}" size="1"> <apex:selectOptions value="{!Items}"/> </apex:selectlist></td><td> <apex:inputfield value="{!itr.EndDateTime}" id="end"/></td><td> <apex:selectlist value="{!SelectedItem2}" size="1"> <apex:selectOptions value="{!Items}"/> </apex:selectlist></td><td> <apex:inputfield value="{!itr.Status__c}" id="status" /></td><td> <apex:inputField value="{!itr.Type__c}" id="type"/></td><td> <apex:inputField value="{!itr.Consultancy_Duration__c}" id="duration"/></td><td> <apex:inputField value="{!itr.Project_Phase__c}" id="phase"/></td><td> <apex:inputField value="{!itr.Location}" id="location"/></td><td> <apex:inputField value="{!itr.Description}" id="description"/></td> </tr> </table> <apex:variable var="counter" value="{!counter+1}"/> </apex:repeat>
Once you open the '{!' you are in merge syntax until you close the '}', so you don't need to open/close on each field:
I'm not 100% sure that this will work, as I can't recall having a conditional value for a selectlist before.
I have tried this. I am getting this error: Unknown property 'IF(counter=1,selectedItem,selectedItem2)'
selectedItem and selectedItem2 variable are here:
Actually my problem was below link. I have created this topic for as an alternative solution.
http://boards.developerforce.com/t5/Apex-Code-Development/How-to-use-apex-selectlist-into-apex-repeat/td-p/557521
The error that you saw was the reason that I put I wasn't 100% sure - some attributes require a property rather than allowing merge syntax to determine the value. I'd expect action methods to behave the same, now that I've seen the results of your attempt.