Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-4023

SelectField options don't allow to set the same value into two different select options.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • None
    • 6.2
    • forms
    • None

      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:
      SelectFieldFactory line 149 that is uses the options value as being the item ID in the data container optionContainer:

      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:
      SelectFieldFactory.patch

      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.

        Acceptance criteria

              Unassigned Unassigned
              cringele Christian Ringele
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD