When I try to save, the page gets saved but returns a Visualforce error: System.NullPointerException: Argument 1 cannot be null
Class.UserStatsController.getValues: line 20, column 1
Following is the code for visual pageVF:
<apex:page Controller="UserStatsController">
<apex:sectionHeader title="Goal Revision Dashboard" subtitle="District View"/> <apex:pageBlock title="User Stats">
<apex:form > <apex:actionRegion > <apex:actionFunction name="RefreshRgn" rerender="dist, District" > <apex:param name="firstParam" assignTo="{!Regn}" value="" /> </apex:actionFunction>
<apex:sectionHeader title="Goal Revision Dashboard" subtitle="District View"/>
<apex:pageBlock title="User Stats">
<apex:form >
<apex:outputLabel value="Region" />
<apex:selectList value="{!Regnregn}" size="1" id="Region" required="true" onchange="RefreshRgn(this.value)">required="true">
<apex:selectOptions value="{!Valuesr}" />
</apex<apex:SelectList>actionSupport event="onchange" reRender="districtSelect"/>
</apex:actionRegion>SelectList>
<apex:outputPanel id="districtSelect">
<apex:outputLabel value="District" />
<apex:selectList value="{!dist}" size="1" id="dist" required="true">
<apex:selectOptions value="{!valuesValues}">
<apex:actionsupport event="onchange" rerender="SalesId""/>
</apex:selectOptions>
selectList>
</apex:selectList>
</apex:form>outputPanel>
</apex:pageBlock>page>
</apex:page>
And following is the controller
public with sharing class UserStatsController {
public string Regnregn {get; set;}
public string dist {get; set;}
public list <SelectOption> getValuesr()
{
list <selectoption> lsreg = new List<selectoption> ();
lsreg.add(new SelectOption('', '--None--'));
for (User_Stats__C RegnRgn : [SELECT Region__c FROM User_Stats__C where Region__c != null and Region__c != 0 and District__c != null and District__c != '0' limit 10])
{
lsreg.add(new selectoption(string.valueOf(RegnRgn.Region__c), string.valueOf(RegnRgn.Region__c)));
}
return lsreg;
}
public list <SelectOption> getValues()
{
list <selectoption> ls public= listnew <SelectOption>List<selectoption> getValues();
{
ls.add(new SelectOption('', '--None--'));
list <selectoption> lsInteger regnInt = new(regn!=null) List<selectoption>? Integer.valueOf(regn); : -1;
for (User_Stats__C dist : [SELECT District__c FROM User_Stats__C where Region__c =: integer.valueof(apexpages.currentpage().getparameters().get('Regn'))regnInt and District__c != '' and Region__c != null and Region__c != 0 limit 10])
{
ls.add(new selectoption(dist.District__c, dist.District__c));
}
return ls;
}
}
Thanks in advance!.