[MGNLUI-4023] SelectField options don't allow to set the same value into two different select options. Created: 22/Sep/16 Updated: 08/Mar/21 Resolved: 08/Mar/21 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | forms |
| Affects Version/s: | 6.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Low |
| Reporter: | Christian Ringele | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| Template: |
|
||||
| Patch included: |
Yes
|
||||
| Acceptance criteria: |
Empty
|
||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||
| Date of First Response: | |||||
| Epic Link: | Dialog UX improvements | ||||
| Description |
|
If you set into two select field options the same value, the dialog does not open. I admit its a rare case, but its still a bug and I can imagine use cases where this is needed. The reason for the error is in:
Object value = DefaultPropertyUtil.createTypedValue(fieldType, option.getValue());
Item item = optionContainer.addItem(value);
I created a patch, I think the SelectOptionDefinition name is the better value, as its for sure unique: I delegated to a method info.magnolia.ui.form.field.factory.SelectFieldFactory.determinateBestItemName(SelectFieldOptionDefinition) to determine the best name, in some cases the name is null. Maybe a better determination can be found for production code. |
| Comments |
| Comment by Christian Ringele [ 26/Sep/16 ] |
|
Its clear that the case having in top selectOption the same value is rare and doesn't make much sense. One of the resulting problems is: BUT it still should not result in an error which prevents the dialog from opening. |
| Comment by Roman Kovařík [ 08/Mar/21 ] |
|
rgange Could you check if this happens in the new framework? |
| Comment by Richard Gange [ 08/Mar/21 ] |
|
Looking at the detail for optionListDatasource its options are of List type which should allow duplicates. Then looking at the detail for ComboBoxFieldFactory I don't see anywhere the options are being used. So it is decoupled. And testing it does seem to be working: |