You need to sign in to do that
Don't have an account?
chuckwalley
Msg: Return type of an Apex action method must be a PageReference - clues???
I'm trying to pass a dynamic picklist from my controller to my page. I've successfully used this technique in the past, but now, I get the following message:
Return type of an Apex action method must be a PageReference. Found: core.apexpages.el.ApexELResolver$VisualforceArrayList
This is triggered by event="onchange" action="{!getTeamMembers}" in the section of code associated with the "Sales Team" output label.
The page code is:
<apex:pageblockSectionItem > <apex:outputLabel value="Sales Team:" /> <apex:selectList value="{!vChosenSalesTeam}" multiselect="false" size="1" > <apex:selectOptions value="{!SalesTeams}"/> <apex:actionSupport event="onchange" action="{!getTeamMembers}" rerender="USAT" /> </apex:selectList> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputLabel value="Team Member:" for="TeamMembers"/> <apex:selectList id="TeamMemberList" value="{!vChosenSalesPerson}" multiselect="false" size="1" > <apex:selectOptions value="{!TeamMembers}"/> </apex:selectList> </apex:pageblockSectionItem>
The controller is:
Public list<selectOption> getTeamMembers() { System.debug('#################### USAT_GD_ShareRefPageExtension MilePost getTeamMembers-0100'); System.debug('#################### vChosenSalesTeam: ' + vChosenSalesTeam); List<SelectOption> TeamMembers = new List<SelectOption>(); TeamMembers.add(new SelectOption('- None -', '- None -')); for (User UList : [SELECT Id, Name FROM User WHERE Sales_Team__c = :vChosenSalesTeam AND Sales_Team__c != null AND IsActive = true AND AMS_Territory__c != null AND Property__c in ('1531 - Republic Media', 'NST', 'USAT', 'USAT SPORTS', 'USA WEEKEND') ORDER BY Name LIMIT 125]) { System.debug('#################### USAT_GD_ShareRefPageExtension MilePost getTeamMembers-0200'); System.debug('#################### UList.Id: ' + UList.Id); System.debug('#################### UList.Name: ' + UList.Name); System.debug('#################### USAT_GD_ShareRefPageExtension MilePost getTeamMembers-0300'); TeamMembers.add(new SelectOption(UList.Id, Ulist.Name)); } System.debug('#################### USAT_GD_ShareRefPageExtension MilePost getTeamMembers-0400'); return TeamMembers; //return null; }
Any clues are greatly appreciated.
Thanks,
Chuck
method should return a pagereference to a page that reflects your changes. Otherwise, it doesn't know what to display. Alternatively, Returning null should refresh the page.
All Answers
method should return a pagereference to a page that reflects your changes. Otherwise, it doesn't know what to display. Alternatively, Returning null should refresh the page.
Yep, thanks. I finally realized I needed a different method.
Thanks for the help