mojarra icon indicating copy to clipboard operation
mojarra copied to clipboard

selectMany components swallow/forgets preselected disabled SeletItems

Open javaserverfaces opened this issue 13 years ago • 15 comments
trafficstars

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]

javaserverfaces avatar Oct 19 '12 15:10 javaserverfaces

Reported by dueni

javaserverfaces avatar Oct 19 '12 15:10 javaserverfaces

dueni said: added changebundle.txt, test page and test managed bean.

javaserverfaces avatar Oct 19 '12 15:10 javaserverfaces

@manfredriem said: Can you explain why you think you need this fix? Preferably by showing us an example application.

javaserverfaces avatar Oct 19 '12 19:10 javaserverfaces

@manfredriem said: Hanspeter, am I to understand this also fails on 2.1? If so which release? Thanks!

javaserverfaces avatar Oct 31 '12 14:10 javaserverfaces

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

javaserverfaces avatar Oct 31 '12 21:10 javaserverfaces

@edburns said: Hello Hanspeter,

As you know, 2.2 is closing down. Can we safely defer this til a later release?

javaserverfaces avatar Feb 20 '13 21:02 javaserverfaces

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

javaserverfaces avatar Feb 20 '13 21:02 javaserverfaces

File: changebundle.txt Attached By: dueni

javaserverfaces avatar Oct 19 '12 15:10 javaserverfaces

File: selectMany.xhtml Attached By: dueni

javaserverfaces avatar Oct 19 '12 15:10 javaserverfaces

File: SelectManyBean.java Attached By: dueni

javaserverfaces avatar Oct 19 '12 15:10 javaserverfaces

Issue-Links: is related to JAVASERVERFACES_SPEC_PUBLIC-1183

javaserverfaces avatar Oct 19 '12 15:10 javaserverfaces

Was assigned to dueni

javaserverfaces avatar Oct 19 '12 15:10 javaserverfaces

This issue was imported from java.net JIRA JAVASERVERFACES-2555

javaserverfaces avatar May 02 '17 09:05 javaserverfaces

Marked as duplicate on Thursday, April 18th 2013, 7:25:47 am

javaserverfaces avatar Apr 18 '13 14:04 javaserverfaces

Reopening as this issue is still present and it's unclear which duplicate it's originally being closed of.

BalusC avatar Feb 16 '18 16:02 BalusC