I have a VF select-list component on a Visualforce page. This select-list is populated by a controller method. When adding this method to controller, the submit button (linked to a pageReference !Save in the controller) stops working. The page just seems to refresh when i click it and the record I want to create is not inserted. Below is the VF page component:
<apex:outputLabel style="font-size:11px; font-family:Verdana ">Health Plan</apex:outputLabel><br/>
<apex:selectList size="1" value="{!cs.Health_Plan__c}" label="" styleClass="myField" >
<apex:selectOptions value="{!SNANAMatch}" />
</apex:selectList><br/><br/>
And below is the method:
User u = [SELECT Id, ContactId, FirstName FROM User WHERE Id = :UserInfo.getUserId()];
Contact c = [SELECT Id, LastName, AccountId FROM Contact WHERE Id =:u.ContactId];
Account a = [SELECT Id, Name FROM Account WHERE Id = :c.AccountId];
List<Services_NaviNetAccountNumbers_Accounts__c> sn = [SELECT Id, Name, Service_Offering__r.NaviNet_Display_Name__c FROM Services_NaviNetAccountNumbers_Accounts__c WHERE Account__c = :a.Id];
List<Service_Offering__c> serviceList = new List<Service_Offering__c>();
public Set<SelectOption> getSNANAMatch(){
Set<SelectOption> DeDupedHPList = new Set<SelectOption>();
DeDupedHPList.add(New SelectOption('Not Health Plan Related', 'Not Health Plan Related'));
List<String> HealthPlanStrings = New List<String>();
for (Services_NaviNetAccountNumbers_Accounts__c snanas : sn){
HealthPlanStrings.add(snanas.Service_Offering__r.NaviNet_Display_Name__c);
}
HealthPlanStrings.sort();
for (String plan : HealthPlanStrings){
deDupedHPList.add(new SelectOption(plan, plan));
}
return DeDupedHPList;
}
This seems to work well with other functions including the apex:SelectOptions value = "{!methodhere} or when using a manually generated list of apex:selectoption 's but for some reason this method appears to be blocking the submission. It does not make much sense since this method is what populates the values for the select-list and is already complete complete by the time one would click "Submit."
Is there anything I am missing here that would have this method keep my PageReference Save() from executing properly?
Thanks,
CP