I'd like to submit the values of selected checkboxes as a string array.
The code below only sends through the values correctly if they are being passed through the first time around and the size of savedSelectedIds is zero. This is fine behavour
.
However if there are already selected ids and
Code:
savedSelectedIds.size() > 0
the values passed to the bean are always the initial values irregardless of which checkboxes have/have not been selected upon submit. Here is the code:
Code:
UIBranchContainer showSwitchGroup = UIBranchContainer.make(
form, "multiple:");
// Things for building the UISelect of Assignment Checkboxes
List<String> assignLabels = new ArrayList<String>();
List<String> assignValues = new ArrayList<String>();
UISelect assignSelect = UISelect.makeMultiple(showSwitchGroup, "multiple-holder", new String[] {}, new String[] {}, selectionOTP,
savedSelectedIds.size() > 0 ? savedSelectedIds.toArray(new String[savedSelectedIds.size()]) : new String[] {});
String assignSelectID = assignSelect.getFullID();
for (String userId : selectUserIds) {
EvalUser user = commonLogic.getEvalUserById(userId);
assignValues.add(user.userId);
assignLabels.add(user.displayName);
UIBranchContainer row = UIBranchContainer.make(showSwitchGroup,"multiple-row:");
UISelectChoice choice = UISelectChoice.make(row, "multiple-box", assignSelectID, assignLabels.size()-1);
UISelectLabel lb = UISelectLabel.make(row, "multiple-label", assignSelectID, assignLabels.size()-1);
UILabelTargetDecorator.targetLabel(lb, choice);
}
assignSelect.optionlist = UIOutputMany.make(assignValues.toArray(new String[assignValues.size()]));
assignSelect.optionnames = UIOutputMany.make(assignLabels.toArray(new String[assignLabels.size()]));
I know I'm missing something, but i just can't put my finger on it.