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
nununinununi 

rendering fields based on picklist values

Can you guys please tell me what I am doing wrong here? I am trying to render a field based on the value of another picklist field. Does not work.
<apex:page standardController="Event">
    <apex:form id="blue">
        <apex:sectionHeader title="Event"/> 
        <apex:pageblock id="pgblk" title="Event Information">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!Save}"/>
                <apex:commandButton value="Cancel" action="{!Cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection id="pgBlockSectionEventInfo" title="Event Information" collapsible="false" columns="1" >
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>Date</apex:outputLabel>
                    <apex:inputField id="Date" value="{!Event.ActivityDate}" showDatePicker="true"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >                    
                    <apex:outputLabel>Contact Type</apex:outputLabel>
                    <apex:actionregion>
                    <apex:inputField id="Type" value="{!Event.Type}"/>
                    <apex:actionSupport event="onchange" rerender="output" />
                    </apex:actionregion> 
                </apex:pageBlockSectionItem>
                
                <apex:pageBlockSectionItem id="EventName">
                    <apex:outputLabel>Event Name</apex:outputLabel>
                    <apex:outputpanel id="output">
                    <apex:inputField id="Name" value="{!Event.Event_Name__c}" rendered="{!Event.Type == 'External Outreach Event'}"/>
                    </apex:outputpanel>
                </apex:pageBlockSectionItem>
                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel>Contact Person</apex:outputLabel>
                    <apex:inputField id="Person" value="{!Event.Contact_Person__c}"/>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>
Best Answer chosen by nununi
BalajiRanganathanBalajiRanganathan
you have to add the action support to the input field. currently your input field is closed before the actiuon support
Copy the line below instead of 17 and 18
                    <apex:inputField id="Type" value="{!Event.Type}">
                    <apex:actionSupport event="onchange" rerender="output" /></apex:inputField>