2

I am developing VF page and have couple of pick list values but I can't access any of the selected picklist value in apex controller.

I have modified a code little for simplicity. I am getting null value in the executeFilter method for selectedFilterId. Can you help what I am missing here?

Thanks!

    <apex:pageblockSectionItem >
        <apex:outputPanel>
            <apex:selectList size="1" id="filterValueSelector" value="{!selectedFilterId}" style="width:100px;">
                <apex:selectOptions value="{!filterValues}" />
                <apex:actionSupport event="onchange"  action="{!executeFilter}" />
            </apex:selectList>  
        </apex:outputPanel>
    </apex:pageblockSectionItem>


public String selectedFilterId {get;set;}
    public List<SelectOption> getFilterValues(){
        List<SelectOption> options = new List<SelectOption>();
        options.addAll( MyFilterLayoutFunctions_ims.getFilters());
        return options;
    }
    public void executeFilter(){
        System.debug('*******Selected Filter ID: *******'+ selectedFilterId );      
    }
9
  • What if you add a rerender to the action support?
    – Eric
    Jul 12, 2015 at 0:15
  • 1
    Thanks Eric. I already have a rerender in my code I have just removed it in the above snippet.
    – user360
    Jul 12, 2015 at 0:37
  • 1
    when you look at the debug log - do you not see the setter for selectedFilterId being invoked? and, a wild guess - if above is an edited snippet - any chance in your code under test that the event name is not onchange - it is case sensitive I believe
    – cropredy
    Jul 12, 2015 at 0:37
  • 1
    Thanks! Its working now. There was an issue with my rerender tag. Its working after fixing it. Thanks again for help!
    – user360
    Jul 12, 2015 at 1:13
  • @user360 - So what was the issue since you already had a rerender?
    – Eric
    Jul 12, 2015 at 2:05

1 Answer 1

0

As Eric mentioned in his earlier comment, after adding rerender to the action support I am able to access the pick list value in the controller.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .