+ Start a Discussion

Visualforce Dependent Picklist actionSupport Problem



The Problem I’m having is that the actionSupport function SearchTemplates from my dependent picklist is only running once when I set the value. When I change the values again it does not run my SearchTemplates method. What is happening is that Salesforce is removing the onchange event from my select list after running the action once. I think this maybe a Salesforce bug. Is there a workaround with out changing my data model?


Below is a simple code example of what I am trying to do:


Visualforce Page


<apex:page controller="TemplateCont" >
<apex:form >
<apex:actionRegion >
<apex:inputField value="{!aTemplate.Category__c}"/>
<apex:inputField value="{!aTemplate.Subcategory__c}">
<apex:actionSupport action="{!SearchTemplates}" event="onchange" rerender="matchingTemplates" status="status"/>
<apex:actionStatus startText=" Please wait..." id="status"/>

<apex:pageBlock title="Matching Templates" id="matchingTemplates" >







public with sharing class TemplateCont {
public Template__c aTemplate{get; set;}
public List<Template__c> matchingTemplates{get; private set;}
public TemplateCont(){ aTemplate = new Template__c(); matchingTemplates = new List<Template__c>(); } public void SearchTemplates(){ matchingTemplates = [SELECT name, category__c, subcategory__c FROM Template__c where category__c=:aTemplate.Category__c and subCategory__c=:aTemplate.Subcategory__c]; } }



Would be greatfull for any help.






Have you tried re-rendering the section contained by your actionregion as well as the results list? 


I tryed re-rendering the section contained by the actionregion and it does not work. I found out that if I changed the apiVersion down to 18.0 from 19.0 it would work but you do not get the dependent picklist functionality which is needed. Is this a Salesforce bug?


I too am facing this problem. Onchange event works fine sometimes but doesnt other times.



<apex:inputFiled value="{!opportuniyt.ControllingField__c}" onchange="alert('hi');"/>




But it works fine one time when I use onblur event instead of onchange and after that one time nothing happens.



function dummyFunctionJS() {
    alert('before ');
<apex:actionFunction name="dummyFuncJSFunc" action="{!dummyFunc}" reRender="parentPanelId" immediate="true" onbeforedomupdate="alert('dom update alert');"/>
<apex:inputFiled value="{!opportuniyt.ControllingField__c}" onblur="actionFunctionMethod();"/>




I filed a bug with salesforce where actionSupport doesn't work on the "child" of a dependent picklist.  They've agreed it's indeed a bug and I got the feeling the timeframe was 6+ months out.  They suggested that I use the onchange event instead, which works great, but if you integrate it with an actionFunction, it only does the desired behavior once.  


I also bumped down the api version to 18 from 19 and the actionFunction fires on more than the one time.  So I believe these two issues are related.


any update on this? 


No updates with this bug. I have ran into the same problem.


So years after initial reporting of this and its still broken????



i am faced with this problem as well. what is the bug tracking # we should get on top of SFDC to fix this. 2 years of a reported bug that they admitted is a bug is not acceptable.

Vijay s 16Vijay s 16
Any updates on this. I am struck with this. Any workaround or solution will be helpful
Antonio Luzio 5Antonio Luzio 5
Same problem is happening with me. :-(