You need to sign in to do that
Don't have an account?

Need Help Storing Picklist Value in an Apex Parameter
Hello,
I have a custom related list built on a Visual Force that we have embedded on the Account Layout. This related list shows a series of custom Sales Team records. Above the related list, we have a picklist that displays various regions. We want users to be able to use this picklist as a filter so that when they select a region from the dropdown and click a button, the related list filters to only display the records who region matches the value selected in the picklist.
I am having trouble getting the selected value in the picklist to be referenced in my Apex Class.
Here is a subset of my code:
This is my Region picklist. It pulls the list of values from an Apex function
<apex:selectList size="1" id="regionfilter">
<apex:selectOptions value="{!DistinctRegionValuesFilter}"></apex:selectOptions>
</apex:selectList>
This is my button on the form. The attribute I am having trouble with is the value attribute. I want to pass in the selected picklist value, but that is not happening. Instead, my debugs show that my region parameter is null:
<apex:commandButton value="Go" action="{!refreshRelatedList}" reRender="form">
<apex:param name="region" value="regionfilter"/>
</apex:commandButton>
However, if I hardcode the value attribute to one of my regions, such as USA, whenever I click the button, it successfully filters my related list to only show Sales Teams with USA as the region.
<apex:commandButton value="Go" action="{!refreshRelatedList}" reRender="form">
<apex:param name="region" value="USA"/>
</apex:commandButton>
I feel like I'm close, so does anyone know of a simple way I can have the selected picklist value be stored as my apex parameter?
Thanks!
Mikey
I have a custom related list built on a Visual Force that we have embedded on the Account Layout. This related list shows a series of custom Sales Team records. Above the related list, we have a picklist that displays various regions. We want users to be able to use this picklist as a filter so that when they select a region from the dropdown and click a button, the related list filters to only display the records who region matches the value selected in the picklist.
I am having trouble getting the selected value in the picklist to be referenced in my Apex Class.
Here is a subset of my code:
This is my Region picklist. It pulls the list of values from an Apex function
<apex:selectList size="1" id="regionfilter">
<apex:selectOptions value="{!DistinctRegionValuesFilter}"></apex:selectOptions>
</apex:selectList>
This is my button on the form. The attribute I am having trouble with is the value attribute. I want to pass in the selected picklist value, but that is not happening. Instead, my debugs show that my region parameter is null:
<apex:commandButton value="Go" action="{!refreshRelatedList}" reRender="form">
<apex:param name="region" value="regionfilter"/>
</apex:commandButton>
However, if I hardcode the value attribute to one of my regions, such as USA, whenever I click the button, it successfully filters my related list to only show Sales Teams with USA as the region.
<apex:commandButton value="Go" action="{!refreshRelatedList}" reRender="form">
<apex:param name="region" value="USA"/>
</apex:commandButton>
I feel like I'm close, so does anyone know of a simple way I can have the selected picklist value be stored as my apex parameter?
Thanks!
Mikey
Let me know if that helps.