I want to dynamically show a picklist depending on the selection of another picklist so the user can enter a required field for a particular record type.
VF Code
<apex:page StandardController="Contact" extensions="AKF_Save_Contact">
<apex:form id="form">
<apex:pageBlock >
<apex:pageBlockButtons>
<apex:commandButton value="Next" action="{!saveContact}" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem>
<apex:outputLabel value="First Name: " for="firstName"/>
<apex:inputField id="firstName" value="{!c.firstName}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Last Name: " for="lastName"/>
<apex:inputField id="lastName" value="{!c.LastName}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Record Type: " for="recordType"/>
<apex:selectList size="1" value="{!selectedValue}">
<apex:actionSupport event="onchange" action="{!checkForIndustry}" reRender="industryRole1"/>
<apex:selectOptions value="{!recordTypes}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:outputPanel id="industryRole1">
<apex:pageBlockSectionItem rendered="{!industrySelected}" >
<apex:outputLabel value="Industry Role: " for="industryRole" />
<apex:inputField id="industryRole" value="{!c.Industry_Role__c}" />
</apex:pageBlockSectionItem>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller method
public void checkForIndustry () {
System.debug('selectedValue----'+selectedValue);
if (selectedValue == 'Industry') {
industrySelected = true;
}
}
The debug statement in the method never fires. I do get an log in the dev console with no debug statements. The "Next" button works. What is wrong?