You need to sign in to do that
Don't have an account?
Carla Cook
How can I build a selectList with selectOption based on field content?
How can I build a selectList with selectOption based on field content? And, in general, how can IF's be added to Visual Force code?
<apex:selectList >
If RecordType.Name contains Hiring, I'd like TWO selectOption statements, if Name does not contain Hiring, I'd like a different selectOption statement.
When I execute the code below, ALL three selectOption statements execute every time.
Here's the code....
<apex:selectList>
{ !IF (CONTAINS ({!Engagement__c.RecordType.Name},"Hiring"), <apex:selectOption itemLabel="Initial Contact for Hiring Need" itemValue="Initial Contact"/>
<apex:selectOption itemLabel="Follow-up Contact for Hiring Need" itemValue="Followup Contact"/>,
<apex:selectOption itemLabel="NOT Hiring Need" itemValue="NOT Hiring Need"/> ) }
</apex:selectList>
<apex:selectList >
If RecordType.Name contains Hiring, I'd like TWO selectOption statements, if Name does not contain Hiring, I'd like a different selectOption statement.
When I execute the code below, ALL three selectOption statements execute every time.
Here's the code....
<apex:selectList>
{ !IF (CONTAINS ({!Engagement__c.RecordType.Name},"Hiring"), <apex:selectOption itemLabel="Initial Contact for Hiring Need" itemValue="Initial Contact"/>
<apex:selectOption itemLabel="Follow-up Contact for Hiring Need" itemValue="Followup Contact"/>,
<apex:selectOption itemLabel="NOT Hiring Need" itemValue="NOT Hiring Need"/> ) }
</apex:selectList>
Vivek D
Inside formula you don't need to include the markups for the fields, make the correction here