[MGNLUI-5532] Issue with nullRepresentation vs default value in FieldBinders Created: 28/Nov/19  Updated: 22/Jul/20  Resolved: 24/Jan/20

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2

Type: Bug Priority: Neutral
Reporter: Milan Divilek Assignee: Adam Siska
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-5325 Support defaultValue in fields of new... Closed
relation
is related to MGNLUI-5478 Issue with null representation in Tex... Closed
Template:
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
Sprint: UI Framework & 6.2 Ramp up 15
Story Points: 3

 Description   

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


Generated at Mon Feb 12 09:27:30 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.