+ Start a Discussion
emandra_kfemandra_kf 

Field Dependencies retaining prior value in picklist

I'm having trouble with two picklist fields in my VF page. To start, I created a page using the example provided here:  http://developer.force.com/cookbook/recipe/dynamically-updating-a-page. As the cookbook illustrates, I'm dynamically displaying different fields based on the selection of a picklist field. In my case, the picklist field triggering the rerendering is called "Activity Type". It all works great. 

 

At the same time, "Activity Type" is also configured in my custom object as a Controlling Field and its Dependent Field is called "Device". On my VF page, when an Activity Type is selected, the appropriate pageBlockSection rerenders and the Device picklist is updated; however, the Device field remains set to its prior value and the prior value is part of the new picklist values - even though it is no longer a valid option based on the Field Dependecy configuration.

 

If I use a standard layout page (non VF page), the Activity Type - Device dependency works fine so there is something about the rerendering that is causing the prior value of Device to remain set. Also, I tried moving the Device field inside and outside the rerendered pageBlockSection and the behavior did not change.

 

Any suggestions on how to clear out the Device field's prior value so the updated picklist includes only the valid options?