I have a VF page with two select lists. I'm trying to pass the value selected in the first select list to my controller method that returns a list of select options for the second select list. I'm using actionSupport component, but the parameter is not getting passed back to the controller. In my debug, the event fires on the actionSupport and I enter the method, but the parameter value is not getting passed to the controller. I think it might be related to reRender, but I haven't been able to get it to work.
Here is the VF page code:
<apex:selectList value="{!innovationCategory}" size="1" id="cat">
<apex:selectOptions value="{!categories}"/>
<apex:actionSupport event="onchange" reRender="subCat" >
<apex:param name="myParam" value="{!innovationCategory}" />
</apex:actionSupport>
</apex:selectList>
<apex:selectList value="{!subCategory}" size="1" id="subCat">
<apex:selectOptions value="{!subCategories}"/>
</apex:selectList>
Here is the controller method:
public List<SelectOption> getSubCategories(){
system.debug('**************** we are inside the getSubCategories method');
string catName = Apexpages.currentPage().getParameters().get('myParam');
system.debug('**************** catName' + catName);
Map<String, List<SelectOption>> subCatMap = getMapOfSubCat();
system.debug('**************** subCatMap ' + subCatMap);
return subCatMap.get(catName);
}
Thanks for any help.