You need to sign in to do that
Don't have an account?
Bug with apex:selectCheckboxes in Spring13
Right now it seems that anything with the <apex:selectCheckboxes> wont work (regardless of version since I did try bumping it back on both the page and controller). See blog entry for full debugging steps:http://salesforcegirl.blogspot.hu/2013/05/bug-with.html
when trying to use a repeat to populate the Lists via maps it fails as well for both<apex:selectCheckboxes> and <apex:selectList>. But if you do it the long way(like shown bellow), you can get<apex:selectList> to work at the very least, however not the <apex:selectCheckboxes> (which is what i need).
Here is the code:
public class sfg_testBugWithActionButton { public String fGrade {get; set;} public List<SelectOption> soGrade {get; set;} public String resultString {get; set;} public sfg_testBugWithActionButton() { createfilterMap(); resultString = 'on Load of page'; } public PageReference preformAction() { system.debug('Grade: ' + fGrade);//this wont be hit unless you use selectList resultString = 'button action preformed'; return null; } private void createfilterMap() { soGrade = new List<SelectOption>(); soGrade.add(new SelectOption('A', 'A')); soGrade.add(new SelectOption('B', 'B')); soGrade.add(new SelectOption('C', 'C')); }
}
Page:
<apex:page showHeader="true" sidebar="true" controller="sfg_testBugWithActionButton"> <apex:form> <apex:outputpanel id="mainWrap"> <h2>Grade</h2> <apex:selectCheckboxes value="{!fGrade}" layout="pageDirection"> <apex:selectOptions value="{!soGrade}" /> </apex:selectCheckboxes> <apex:commandButton action="{!preformAction}" rerender="renderWrap" value="Submit Action" /> <br /> <apex:outputpanel id="renderWrap"> {!resultString} </apex:outputpanel> </apex:outputpanel> </apex:form> </apex:page>
The values in filterKeys are strings so {!filterKeys[key]} is a string, and <apex:selectCheckboxes> needs a list of strings as the value. So if you change filterKeys to a map from strings to lists of strings, it should work.
All Answers
soGrade = new List<SelectOption>();
soGrade.add(new SelectOption('A', 'A'));
soGrade.add(new SelectOption('B', 'B'));
soGrade.add(new SelectOption('C', 'C'));
}
nope, no joy. still doesnt work. Not to mention if it did that would still be broken functionallity since i am doing it in the constructor technically since the method that does it is being called by the constructor.
If you looked at the blog, you will see that it does work if you dont select a value, but once a value is selected it wont work.
Hi,
Use the below code
You need to get set the SelectCheckbox value because we can select muliple value in one time .
First declare the list of string and get set as below.
public class sfg_testBugWithActionButton {
List<String> fGrade = new List<String>();
public List<SelectOption> soGrade {get; set;}
public String resultString {get; set;}
public sfg_testBugWithActionButton() {
createfilterMap();
resultString = 'on Load of page';
}
public PageReference preformAction() {
system.debug('Grade: ' + fGrade);//this wont be hit unless you use selectList
resultString = 'button action preformed';
return null;
}
public List<String> getFGrade() {
return fGrade;
}
public void setFGrade(List<String> val) {
this.fGrade = val;
}
private void createfilterMap() {
soGrade = new List<SelectOption>();
soGrade.add(new SelectOption('A', 'A'));
soGrade.add(new SelectOption('B', 'B'));
soGrade.add(new SelectOption('C', 'C'));
}
}
I am Get/Seting the fGrade
even if i change it to
it does not work. I even tried the long way like you suggested
and still it does not work.
I found a way to get the single example to work by initalizing the fGrade in the constructor, however this still doesnt work for the example with the map:
The values in filterKeys are strings so {!filterKeys[key]} is a string, and <apex:selectCheckboxes> needs a list of strings as the value. So if you change filterKeys to a map from strings to lists of strings, it should work.
And it works! HAZA!
your the best!