You need to sign in to do that
Don't have an account?
elkid_24
VF Page - Hide/Show fields based on lookup field
Is there a way to hide or show a section/fields based on a lookup field? I currently have a lookup field that returns 1 of 4 names. I'd like to render and/or hide sections based on the name in the lookup field.
I am on Profession Edition and can't use any controllers. Any help would be greatly appreciated.
<b><!-- Activity 1 Show this section if lookup field name = Activity 1--></b> <apex:pageBlockSection title="Activity 1"> <apex:outputField value="{!CEQ__c.Field1__c}"/> <apex:outputField value="{!CEQ__c.Field2__c}"/> </apex:pageBlockSection> <b><!-- Activity 2 Show this section if lookup field name = Activity 2--></b> <apex:pageBlockSection title="Activity 2"> <apex:outputField value="{!CEQ__c.Field3__c}"/> <apex:outputField value="{!CEQ__c.Field4__c}"/> </apex:pageBlockSection>
I am on Profession Edition and can't use any controllers. Any help would be greatly appreciated.
Use below code in your Section/Field rendered tag.
if you want to Check for spacific 1 Name use Below, else if you want use OR condition for multiple names use below
Hope it will help you. MARK BEST ANSWER if its work for you.
Thanks
Karthik
Thank you for your response. I appreciate it. Would you apply the rendered if statement at the end of the output line like this:
If so, I'm getting the error below:
Error: Incorrect parameter type for function 'not()'. Expected Boolean, received Text
you have used " ! " 2 times in that condition not like that.
<apex:outputField value="{!CEQ__c.Field1__c}" rendered="{ ! IF( ! CEQ__c.Act__c ="Activity1",true,false)}"/>-- (wrong)
<apex:outputField value="{!CEQ__c.Field1__c}" rendered="{ ! IF( CEQ__c.Act__c ="Activity1",true,false)}"/>--(Correct)
kinldy use the same as below.
use this above code and let me know.
Mark Best ANSWER if its works.
Thanks
karthik