+ Start a Discussion
Chris987654321Chris987654321 

Dependant picklists on VF page using AJAX re-rendering

I'm coding dependant picklists using re-rendering. In the following code,

 

 

<tr>
<td align="right">
Campus:
</td>
<td align="left">
<apex:outputPanel id="campusPanel">
<apex:selectList id="campusPicklist" value="{!campusId}" size="1">
<apex:selectOptions value="{!campuses}"/>
<apex:actionSupport event="onchange" action="{!campusChanged}"
status="programStatus" immediate="false" rerender="programPanel"/>
</apex:selectList>
<font color="red">*</font>
</apex:outputPanel>
</td>
</tr>


<tr>
<td align="right">
Program:
</td>
<td align="left">
<apex:outputPanel id="programPanel">
<apex:actionStatus id="programStatus" startText="(Loading programs...)">
<apex:facet name="stop">
&nbsp;
<apex:selectList id="programPicklist" value="{!programId}" size="1">
<apex:selectOptions value="{!programs}"/>
<apex:actionSupport event="onchange" action="{!programChanged}"
status="dateStatus" immediate="false"/>
</apex:selectList>
</apex:facet>
</apex:actionStatus>
<font color="red">*</font>
</apex:outputPanel>
</td>
</tr>

 

 

 

 When you select a Campus in the first dropdown it is supposed to refresh the list of Programs offered at that campus in the second dropdown. It actually does refresh once but then if I try changing the campus once more either to a different selection or back to the original selection it does not seem to refresh the list again.

 

Does the onChange event only occur when the dropdown is changed the 1st time? Should I use a different event?

 

Message Edited by Chris987654321 on 02-16-2010 11:09 AM
Best Answer chosen by Admin (Salesforce Developers) 
Chris987654321Chris987654321
I made the program panel rerender itself which fixed the problem