+ Start a Discussion
Christopher PezzaChristopher Pezza 

SelectList passing null everytime onchange

My selectList is continuously passing null as the value to my controller and i dont know why. What am i missing! Thanks! Code Below

VisualForce Page
<div class="form-group">
                                                <label><apex:outputText value="{!$Label.Fee_Select_Default_Fee}"></apex:outputText></label>
                                                <apex:selectList styleClass="form-control" value="{!RemoveFeeSelected}" size="1">
                                                    <apex:selectOptions value="{!RemoveFeeList}"/>
                                                    <apex:actionSupport event="onchange" action="{!NULL}" reRender="TheRemoveListPanel,messages" status="removeselectstatus"/>
                                                <apex:actionStatus id="removeselectstatus">
                                                    <apex:facet name="start">
                                                        <img src="/img/loading.gif"/>
                                            </div><!-- /.form-group -->
                                            <div class="form-group">
                                                <label><apex:outputText value="{!$Label.Fee_Select_Join}"></apex:outputText></label>
                                                <apex:outputPanel id="TheRemoveListPanel">
                                                    <apex:selectList styleClass="form-control" value="{!TodeletePFT}" multiselect="true" size="6">
                                                        <apex:selectOptions value="{!RemoveJoinList}" id="theremovelist"/>
                                            </div><!-- /.form-group -->

Apex Class
Public Id RemoveFeeSelected {get;set;}
Public String[] TodeletePFT {get;set;}

public FeeManagementController() {}

//Used for Picklist for Removal Fee Modal
    public List<SelectOption> getRemoveFeeList() {
 	 	List<SelectOption> FeeList = new List<SelectOption>();
 	 	List<Template_Records__c> TempateFees = [SELECT Id, Text_Field_1__c FROM Template_Records__c];
 	 	FeeList.add(new SelectOption('null','-- None Selected --'));
 	 	for (Template_Records__c t: TempateFees) {
 	 		FeeList.add(new SelectOption(t.Id,t.Text_Field_1__c));
 	 	return FeeList;

//Used for Picklist for Removal Fee Modal
  	Public List<SelectOption> getRemoveJoinList() {        
        System.debug('**' + RemoveFeeSelected);
  		List<SelectOption> RemoveList = new List<SelectOption>();
		List<PFT_Join__c> JoinList = [SELECT Id, Name, Template_Records__r.Text_Field_1__c, Product_Feature__r.Name FROM PFT_Join__c WHERE Template_Records__c = :RemoveFeeSelected];
  		for (PFT_Join__c pft: JoinList) {
  			RemoveList.add(new SelectOption(pft.Id, pft.Name + ' - ([' + pft.Template_Records__r.Text_Field_1__c + '] - [' + pft.Product_Feature__r.Name + '])'));

  		return RemoveList;

You can remove action="{!NULL}" from your actionSupport. Is getRemoveJoinList being called after your change the select list on line 3?

If so, you may want to create a void method that is called in your actionSupport and in getRemoveJoinList that performs the query. This way, you can be sure that the controller is called every time the first select list is changed.

If not, then try to rerender an outputPanel or pageBlockSection that contains both list. I have had some issues rerendering an outputPanel inside of a div.

Please let me know if I can be of any more help.