mojarra
mojarra copied to clipboard
selectMany components swallow/forgets preselected disabled SeletItems
Consider this situation: you have a number of options and some options are already selected but must not be unselected. SelectItem allows to pass a disable item state and the item will be correctly rendered as checked but disabled. If some other options/checkboxes are enabled during decode only the submitted options will survive - the preselected disabled option will be lost since the disabled items checked state is not submitted.
I have a fix ready for that and also a test application - what's currently missing is the unit test for it, but I hope Manfred could help me out with that.
The change works like this: during rendering selected & disabled itemValues will be added to a Set that is maintained on the component attributes map with name "selectedDisabledItems". This Set, if existing, will be merged to the newValues[] array with the submitted values.
See attached changebundle.txt and the sources of the test bean and page.
Affected Versions
[2.1.20]
Reported by dueni
dueni said: added changebundle.txt, test page and test managed bean.
@manfredriem said: Can you explain why you think you need this fix? Preferably by showing us an example application.
@manfredriem said: Hanspeter, am I to understand this also fails on 2.1? If so which release? Thanks!
dueni said: Hi Manfred.
I think this behavioral flaw was in since selectManyCheckbox ever supported selectItem with itemDisabled="true" - which might be since the beginning. I think nobody could imagine to have selected disabled checkboxes being part of a selectManyCheckbox - but I am sure the use case as described in issue description is valid.
Did you try the example applications I had linked?
Best regards Hanspeter
@edburns said: Hello Hanspeter,
As you know, 2.2 is closing down. Can we safely defer this til a later release?
dueni said: Hi Ed.
Since this problem was in the select components from the beginning (version 1.0?) one can say it can be safely deferred - otherwise it would have popped up before. For our purpose we have our own select input component with that fix in - so we do not depend on this fix. I just thought it would be good that RI also can handle such disabled selected options.
Regards, Hanspeter
File: changebundle.txt Attached By: dueni
File: selectMany.xhtml Attached By: dueni
File: SelectManyBean.java Attached By: dueni
Issue-Links: is related to JAVASERVERFACES_SPEC_PUBLIC-1183
Was assigned to dueni
This issue was imported from java.net JIRA JAVASERVERFACES-2555
Marked as duplicate on Thursday, April 18th 2013, 7:25:47 am
Reopening as this issue is still present and it's unclear which duplicate it's originally being closed of.