[Logo] RSF Discussions Forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Submitting multiple checkbox values as istringarray.  XML
Forum Index -> RSF Help and Problems
Author Message
lovenalube
Request-scope Wrangler
[Avatar]

Joined: 31/10/2008 07:27:03
Messages: 5
Offline

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.

[Thumb - params.jpg]
 Filename params.jpg [Disk] Download
 Description This is a snapshot of the params generated by this view when the page is FIRST rendered with NO checkboxes checked then a few are checked checkbox is selected and the form submitted.
 Filesize 53 Kbytes
 Downloaded:  79 time(s)

[Thumb - params2.jpg]
 Filename params2.jpg [Disk] Download
 Description Attached is a snapshot of the params generated by this view when the page is rendered the SECOND time with some checkboxes checked then one more checkbox is selected and the form submitted.
 Filesize 33 Kbytes
 Downloaded:  65 time(s)

[Email]
lovenalube
Request-scope Wrangler
[Avatar]

Joined: 31/10/2008 07:27:03
Messages: 5
Offline

I've found the solution to this issue. Due to something lacking in the application elsewhere, values were being passed to the bean but not being set. Hence I thought they weren't being passed at all.

In actuality, I had implemented the UISelect component properly.
[Email]
antranig
Request-scope Wrangler

Joined: 03/04/2006 13:29:55
Messages: 643
Offline

Thanks, Lovemore - sorry I couldn't come round to a reply - I did spend some time staring at your binding log, but nothing very obvious occurred to me
 
Forum Index -> RSF Help and Problems
Message Quick Reply
Go to:   
Powered by JForum 2.1.6 © JForum Team