You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by tristan_colson <tr...@wickedbear.com> on 2008/04/22 00:18:41 UTC

Pre-checking items in checkboxlist (or multiple select box)

I cannot for the life of me figure out how to pre-check/select items in a
checkbox list or a multiple select box. 
As long as the input field is linked to exactly one value, like in a radio
list or a single select box, it works fine, but I can't figure out how to
pass a list of items to check and get it to work.

Here are a couple of examples:

Checkbox: 
<s:checkboxlist name="theCheckBoxesKeys" list="allCheckBoxes"
listKey="value" listValue="label"/>

theCheckBoxesKeys is a list of integers, and allCheckBoxes is a list of
(label, value) pairs.

Multiple Select: 
<s:select name="theSelectsKeys" list="allSelect" listKey="value"
listValue="label" multiple="true" size="3"/>

Similarly, "theSelectsKeys" is a list of integers, and allSelect is a list
of (label, value) pairs.

When I initialize the CheckBoxesKeys with several integers (which appear in
the values of allCheckBoxes), I would
expect those check boxes to be checked.
But they aren't. 
Same with the select box.

Can anyone tell me what I am doing wrong?

Thanks!

-- 
View this message in context: http://www.nabble.com/Pre-checking-items-in-checkboxlist-%28or-multiple-select-box%29-tp16815512p16815512.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org