You need to sign in to do that
Don't have an account?

Using "if / then" login in Visualforce
Hi,
I have been through the visualforce documentation and although it has helped me a great detail in being able to provide a custom list of all my events, I would still like to build an if/then statement. Depending on a certain event name I would like the text to be bold for example. Does anyone know what code I can use? Below is my code
<apex:page controller="EventController" showHeader="false">
<apex:repeat value="{!Events}" var="event" id="event_id">
<p><a href="/apex/event_details?id={!event.id}">{!event.name}, {!event.Event_Date__c}</a>
<br/>Description: {!event.Description__c }
if {!event.name} = "marathon" then ....
</p><hr/>
</apex:repeat>
</apex:page>
To implement a conditional in VisualForce, you have to use the "{!IF(critieria, true, false)}" format. You can implement this within the Render= attribute or Style= (or Disable="" for a commandButton) on the various apex Tags to show/hide elements based on a condition. Alternatively, you embed that logic into your Apex Controller and have something like Render="{!showThisElement}" as a tag attribute.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm
Also, be sure to use the PasteCode
button (
) to paste code into messages. Makes it much easier to read.
Mike
All Answers
To implement a conditional in VisualForce, you have to use the "{!IF(critieria, true, false)}" format. You can implement this within the Render= attribute or Style= (or Disable="" for a commandButton) on the various apex Tags to show/hide elements based on a condition. Alternatively, you embed that logic into your Apex Controller and have something like Render="{!showThisElement}" as a tag attribute.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm
Also, be sure to use the PasteCode
button (
) to paste code into messages. Makes it much easier to read.
Mike