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

Switchable field doesn't keep the defaultValue on multi language componentes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 6.2.14
    • 6.2.12
    • None
    • None

    Description

      Steps to reproduce

      1.  Create a switchable field like the example we provide at our docu
        myComponent.yaml
        form:
          properties:
            switchable:
              $type: switchableField
              i18n: true
              field:
                $type: radioButtonGroupField
                layout: horizontal
                defaultValue: foo
                datasource:
                  $type: optionListDatasource
                  options:
                    - name: foo
                      value: foo
                    - name: bar
                      value: bar
              itemProvider:
                $type: jcrChildNodeProvider
              forms:
                - name: foo
                  properties:
                    foo:
                      $type: textField
                - name: bar
                  properties:
                    bar:
                      $type: richTextField
      2.  Create the component on a site which has multiple languages enabled
      3.  Check the defaultValue is selected when opening the dialog
      4.  Switch from fallback local to another one
      5.  Check the defaultValue is not selected

      Expected results

      When user switch language, the defaultValue is selected

      Actual results

      The defaultValue is only selected for the default language when opening the dialog

      Workaround

      N/A

      Development notes

      Tested on Magnolia 5.7 and the "selected" option was working as expected. When you switch between languages, the "selected" option is always properly marked.

      Anyhow, even using the old UI 5 dialog definition, it doesn't work on Magnolia 6, e.g:

      myOldDefinition.yaml
      form:
        tabs:
          - name: tabText
            label: Text
            fields:
              - name: message
                class: info.magnolia.ui.form.field.definition.SwitchableFieldDefinition
                label: Message
                i18n: true
                options:
                  - name: plainText
                    label: Plain
                    selected: true
                    value: plainText
                  - name: richText
                    label: Rich
                    value: richText
                fields:
                  - name: plainText
                    class: info.magnolia.ui.form.field.definition.TextFieldDefinition
                    label: Plain text message
                    rows: 5
                  - name: richText
                    class: info.magnolia.ui.form.field.definition.RichTextFieldDefinition
                    label: Rich text message
                    height: 200
      
      actions:
        commit:
          class: info.magnolia.ui.admincentral.dialog.action.SaveDialogActionDefinition
        cancel:
          class: info.magnolia.ui.admincentral.dialog.action.CancelDialogActionDefinition
      

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                asiska Adam Siska
                ccantalapiedra Carlos Cantalapiedra
                Nucleus
                Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD