[
https://issues.apache.org/jira/browse/WICKET-2853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863818#action_12863818
]
Carl-Eric Menzel commented on WICKET-2853:
------------------------------------------
Hi Brad, thank you for this quickstart. It demonstrates exactly what I
described.
Jeremy, if you look at this you will see that after the submit the middle of
the three checkboxes on the quickstart page will no longer be checked. In my
opinion it should still be checked (or at least that behavior should be
available, such as in my patch with the retaindDisabledSelected flag).
In my patch there is a new testcase "DisabledItemRetainingCheckBoxTest" that
tests for this behavior. I didn't find a problem with FormTester, however - I
just simulate what the browser would be doing: Just sending one of the
checkboxes, even if two are checked and the second one is disabled. That's the
normal behavior as specified in the HTML standard. My testcase tests both the
"old" behavior with the flag off and the "new" behavior with the flag on.
> ListMultipleChoice/CheckBoxMultipleChoice do not retain selected but disabled
> items
> -----------------------------------------------------------------------------------
>
> Key: WICKET-2853
> URL: https://issues.apache.org/jira/browse/WICKET-2853
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.8
> Reporter: Carl-Eric Menzel
> Priority: Minor
> Attachments:
> 0001-retainDisabledSelected-for-listmultiplechoice.patch,
> WICKET-2528_quickstart_demo.zip
>
>
> Suppose in a shop application the user gets to choose from a number of
> options for the product, presented by checkboxes. One or more of these
> options may be mandatory for the given product, so they are not only
> pre-selected in the model and thus checked on the displayed page, but also
> disabled via #isDisabled, so they cannot be deselected.
> On form submit the browser (correctly) does not post these disabled values
> again and ListMultipleChoice#convertChoiceIdsToChoices does not keep these
> values. Upon re-displaying of the page the checkbox is no longer checked, and
> the user can't even check it again, since it is disabled. The behavior is
> demonstrated in the test case contained in the attached patch.
> I propose the attached path to give ListMultipleChoice a new flag called
> retainDisabledSelected. Default in the patch is currently false, though I
> think it could also be set to true. If the flag is true, the patched
> convertChoiceIdsToChoices will go through the old model collection to check
> if any of the selected values were disabled. Any such values will be added to
> the new model collection. If the flag is false, the ListMultipleChoice will
> behave like before. The included testcase verifies the behavior for both flag
> settings.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.