You need to sign in to do that
Don't have an account?
Carla Cook
how-to build selectList conditionally from a VF page using apex
Hi Team,
I've asked similar question, but answer did not solve issue. Is this an order of execution thing or something like that???
See below, where I tried by ultimate goal of condition based on RecordType.Name, even tried a simple IF (1=2) and I still get ALL of the selectOption displayed.
What is the proper technique for this????
Thanks.
I am using this...
<apex:page standardController="MyCustom__c" sidebar="false">
.....
<apex:form >
....
<apex:pageBlockSection title="Build PickList">
......
<apex:selectList >
{ ! IF (1=2)
{
<apex:selectOption itemLabel="1=1" itemValue="1=1"/>
}
}
.....
ultimate goal is this conditional, but even the IF (1=2) does not seem to execute properly
I DO get the MyCustom__c.RecordType.Name A-OK.
However, the IF seems to fail, because I get ALL THREE selectOption displayed every time.
{ !IF
(CONTAINS (MyCustom__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>
I've asked similar question, but answer did not solve issue. Is this an order of execution thing or something like that???
See below, where I tried by ultimate goal of condition based on RecordType.Name, even tried a simple IF (1=2) and I still get ALL of the selectOption displayed.
What is the proper technique for this????
Thanks.
I am using this...
<apex:page standardController="MyCustom__c" sidebar="false">
.....
<apex:form >
....
<apex:pageBlockSection title="Build PickList">
......
<apex:selectList >
{ ! IF (1=2)
{
<apex:selectOption itemLabel="1=1" itemValue="1=1"/>
}
}
.....
ultimate goal is this conditional, but even the IF (1=2) does not seem to execute properly
I DO get the MyCustom__c.RecordType.Name A-OK.
However, the IF seems to fail, because I get ALL THREE selectOption displayed every time.
{ !IF
(CONTAINS (MyCustom__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>
For ex : As in your above problem you are trying to print apex:sectionOption conditionality with the help of If and contains condition operator instead of rendered attribute of <apex:selectOption>.
Also you can bind a apex class variable of list<SelectionOptions> type which you can create dynamically from backend.
Hope this will help you.
All Answers
For ex : As in your above problem you are trying to print apex:sectionOption conditionality with the help of If and contains condition operator instead of rendered attribute of <apex:selectOption>.
Also you can bind a apex class variable of list<SelectionOptions> type which you can create dynamically from backend.
Hope this will help you.
Now I get it. The conditional logic needs to be in the 'rendered' logic.
thanks again.