the way we solved this was to create a hidden field for each checkbox that
holds the value that would be sent if the checkbox were to be checked.  I
then compare the full value array sent by the hidden values with the partial
array sent by the checkboxes to see which ones were checked and which
weren't.

Both of these, of course, are inside a <logic:iterate> block.

    HTH,
        - eric

----- Original Message -----
From: "Tony Karas" <[EMAIL PROTECTED]>
To: "Struts User" <[EMAIL PROTECTED]>
Sent: Thursday, May 10, 2001 8:52 AM
Subject: Checkbox Arrays


> Can anyone help with this?
>
> I have an array of checkboxes in my ActionForm represented by
>
> boolean[] delete;
>
> and I have a setter function
>
> public void setDelete( boolean[] values )
> {
> delete = values;
> }
>
> The problem is that I have only checkboxes that are checked get sent
back -
> so if one checkbox is checked all I get is an array of length 1.
Therefore,
> it is not possible for me to determine which checkbox has been checked.
>
> In the documentation it tells me to use reset() in ActionForm to
initialise
> the values - but this will only work with single checkboxes and not
arrays.
>
> I think I'm stuck.  Is there anyway I can determine which checkbox has
been
> checked - maybe I can get the value to differ for each checkbox.  Will
look
> in to that.
>
> Cheers
> Tony
>
>

Reply via email to