I have a form that contains two multi-select checkboxes in order to select certain days of the week. The first multi-select checkbox works completely fine and I can save the values. However, when I select boxes for the second set of checkboxes it prevents the page from being saved.
I have created the following test controller and page to mimic the issue-- with this example, neither of the checklists will let me save. The logs on my console do not show any errors, just a new log for the page after it refreshes when I press save. Why doesn't it forward the page when I save?
Controller:
public class TestVFPage_Controller {
public String[] weekdays1 {get; set;}
public String[] weekdays2 {get; set;}
public PageReference save() {
PageReference saved = new PageReference('/apex/TestVFSavePage');
saved.getParameters().put('Weekdays1',String.valueOf(weekdays1));
saved.getParameters().put('Weekdays2',String.valueOf(weekdays2));
saved.setRedirect(true);
return saved;
}
public List<SelectOption> getDayOptions() {
List<SelectOption> weekdays = new List<SelectOption>();
weekdays.add(new selectOption('Monday','Monday'));
weekdays.add(new selectOption('Tuesday','Tuesday'));
weekdays.add(new selectOption('Wednesday','Wednesday'));
weekdays.add(new selectOption('Thursday','Thursday'));
weekdays.add(new selectOption('Friday','Friday'));
weekdays.add(new selectOption('Saturday','Saturday'));
weekdays.add(new selectOption('Sunday','Sunday'));
return weekdays;
}
}
Visualforce:
<apex:page tabStyle="HigiConnector_HomePage__tab" controller="TestVFPage_Controller">
<apex:form >
<apex:pageBlock id="pb">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save" />
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Checkbox 1" for="dayInvite" />
<apex:selectCheckboxes value="{!weekdays1}" id="dayInvite" layout="pageDirection">
<apex:selectOptions value="{!dayOptions}"></apex:selectOptions>
</apex:selectCheckboxes>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Checkbox 2" for="refreshInvite" />
<apex:selectCheckboxes value="{!weekdays2}" id="refreshInvite" layout="pageDirection">
<apex:selectOptions value="{!dayOptions}"></apex:selectOptions>
</apex:selectCheckboxes>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:actionRegion>
</apex:pageBlock>
</apex:form>
</apex:page>