I really think this is a bug in Struts 2 checkbox array behaviour!

to solve this problem I have created a variable to keep the value of the
previous selection.
if the actual selection is equals to the previous selection that means the
user want to uncheck the checkbox

this at least works, and is more straightforward than writing an interceptor

bye and thanks robert for your try!!!

2010/2/24 Robert Graf-Waczenski <r...@lsoft.com>

> Post the relevant part of your JSP, please. I know that at least for Struts
> 2.1.8.1 there is a new MultiselectInterceptor class that would solve your
> problem for a select with type=multiple. There is a CheckboxInterceptor
> class as well. Maybe there is none for a checkbox array. Anyway, let us have
> a look at your JSP to see what S2 tags you are using. If all else fails, you
> could write your own interceptor to deal with the issue.
>
> Robert
>
> lucas owen schrieb:
>
> mmm I'm using Struts 2 (struts2-core-2.1.6) and the last checkbox (of a
>> checkbox array) doesn't get unchecked, as I have previously commented...
>>
>> WHY?
>>
>> It seems it has to be always selected one of the checkboxes at least
>>
>> 2010/2/23 Robert Graf-Waczenski <r...@lsoft.com>
>>
>>
>>
>>> lucas owen schrieb:
>>>
>>> Hi struts users,
>>>
>>>
>>>> I'm working with a checkbox array; the problem is that it doesn't work
>>>> as
>>>> a
>>>> single checkbox: I can't have the checkbox array with all checkboxes
>>>> unchecked (apart from the beginning)
>>>>
>>>> Example:
>>>>
>>>> I check checkbox1.
>>>> I check checkbox2.
>>>> I uncheck checkbox2 --> OK
>>>> I uncheck checkbox1 --> checkbox1 doesnt get unchecked
>>>>
>>>> Is this working as normal or I'm performing wrong???
>>>>
>>>> Thanks in advance
>>>> Peter
>>>>
>>>>
>>>>
>>>>
>>>>
>>> This should work correctly out of the box with Struts2 because there are
>>> interceptors and hidden parameters that work the magic for you. In
>>> Struts1,
>>> there is no such magic and the behavior you describe is normal because if
>>> none of the checkboxes is checked, then the resulting browser request
>>> does
>>> not contain the corresponding request parameters *at all*, meaning that
>>> your
>>> server-side state is unchanged. Solution: Implement the
>>> ActionForm.reset()
>>> method to deal with this properly, i.e. reset your form values to null
>>> (or
>>> whatever) when the request parameters are missing.
>>>
>>> Robert
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to