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

Issue with nullRepresentation vs default value in FieldBinders

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 6.2
    • None
    • None
    • None
    • UI Framework & 6.2 Ramp up 15
    • 3

      info.magnolia.ui.field.factory.FieldBinder.Default uses method com.vaadin.data.Binder.BindingBuilder#withNullRepresentation to propagate default value from field definition. This cause that field can't be set to empty because then it's every time converted to default value

      On the other hand info.magnolia.ui.field.TextFieldBinder set com.vaadin.data.Binder.BindingBuilder#withNullRepresentation to empty string which cause that default values is never used

      Reproduce:
      Issue 1

              select:
                label: select
                $type: comboBoxField
                emptySelectionAllowed: true
                defaultValue: Bartok
                datasource:
                  $type: optionListDatasource
                  options:
                    - name: Vivaldi
                      value: Vivaldi
                    - name: Bach
                      value: Bach
                    - name: Bartok
                      value: Bartok
      

      This definition allows empty selection in combobox, but after selecting the empty option and reopening dialog "Bartok" (defaultValue) is selected instead of the empty one

      Issue 2

              salutation:
                label: salutation
                $type: textField
                defaultValue: Mr
                description: hello
      

      In this definition defaultValue is completely ignored, because TextFieldBinder instead sets empty string

        Acceptance criteria

              asiska Adam Siska
              mdivilek Milan Divilek
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD