function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mr209204mr209204 

Showing different fields based on multi-select picklist values

What I am trying to do is have different sections outputFIelds appear based on a multi-picklist. Lets say we have three items in this multi-select picklist...teacher, volunteer and student.

here is what I have so far.

Code:
<apex:page StandardController="Contact" tabStyle="Contact">        
    <apex:sectionHeader title="View Contact" />  
      
    <apex:form >   
           
        <apex:pageBlock title="Contact Detail" id="thePageBlock" mode="edit">                         
        <apex:facet name="footer">
            <apex:outputpanel >
                <apex:commandButton action="{!edit}" value="Edit" styleClass="btn" />                 
                <apex:commandButton action="{!delete}" value="Delete" styleClass="btn" />  
            </apex:outputpanel>                         
        </apex:facet>    
       
                   
            <apex:actionRegion >                
                <apex:pageBlockSection title="Contact Type" columns="1">                    
                    <apex:pageBlockSectionItem >                                                                     
                        <apex:outputPanel >                            
                            <apex:outputField value={!contact.Contact_Type__c}">                                                                                          
                            </apex:outputField>                                                                            
                        </apex:outputPanel>                    
                    </apex:pageBlockSectionItem>       
                </apex:pageBlockSection>            
            </apex:actionRegion>
            
            
                                                            
            <apex:pageBlockSection title="Basic Contact Information" columns="2">                                                               
                <apex:outputField value="{!contact.name}" />
                <p>
                <apex:outputField value="{!contact.MailingStreet}" />
                <apex:outputField value="{!contact.MailingCity}" />
                <apex:outputField value="{!contact.MailingState}" />
                <apex:outputField value="{!contact.MailingPostalCode}" />
                </p>
                <p>
                <apex:outputField value="{!contact.Referred_By__c}" />
                <apex:outputfield value="{!contact.Best_Way_to_Contact__c}" />
                <apex:outputField value="{!contact.Phone}" />
                <apex:outputField value="{!contact.MobilePhone}" />
                <apex:outputField value="{!contact.Email}" />   
                <apex:outputField value="{!contact.Email2__c}" />     
                <apex:outputField value="{!contact.Email3__c}" />
                </p>
            </apex:pageBlockSection>     

            <apex:pageBlockSection title="Teacher Information" rendered="{!contact.Contact_Type__c = 'Teacher'}">       
                <apex:outputField value="{!contact.Certified__c}" />    
                <apex:outputField value="{!contact.Grade_Taught__c}" />                                                                                                  
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Volunteer Information" rendered="{!contact.Contact_Type__c = 'Volunteer'}" >
                <apex:outputField value="{!contact.Watershed__c}" />    
                <apex:outputField value="{!contact.Watershed_Sub__c}" />      
            </apex:pageBlockSection>
                               
        </apex:pageBlock>    
    </apex:form>
</apex:page>

So right now I have two of the sections. the problem is it works fine with when I only have one of the sections. When I added the second section they both do not appear. I've also tried  putting the sections between if statements and still the same result.

Any suggestions and comments are greatly appreciated.

Mitch.

jlojlo
Try this expression: rendered="{!IF(contact.Contact_Type__c = 'Teacher', true, false)}"


Message Edited by jlo on 09-04-2008 09:40 PM
MyGodItsColdMyGodItsCold
Are you really dealing with a multi select picklist? Can the user select more than one? If so, you need to determine which combination was selected.

http://community.salesforce.com/sforce/board/message?board.id=custom_formula&message.id=3017#M3017

Discusses how to wrestle with multi select picklists. If you need code examples, let me know.
mr209204mr209204
Thanks for the link. I was trying to us a multi-select picklist but resorted to just using checkboxes instead.
mr209204mr209204
So...we were toying with this Multi-select picklist (msp) thing and did this.

For every selection we have for the msp we have a checkbox associated with it. Then we created 2 workflows for each check box and then wrote the vf code using the checkboxes. So the checkboxes aren't shown and your users just see the msp.

the workflows bascially say

if msp = x then checkbox = true

if msp <> x then checkbox = false

and now you there you have it.

w00t no code required! well other than vf of course.


Message Edited by mr209204 on 09-25-2008 04:50 PM