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

HiddenFields do not update its value once set

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Neutral
    • None
    • None
    • None
    • None

    Description

      If you have a dialog with a switchable field which is composed by hiddenFields, the first time you save the dialog the proper value is stored at JCR, but, if you edit the component and change that value, the old one remains on JCR.

      This behavior can be reproduced on the demo with the following snippet:

      my-component.yaml
      label: My Dialog shows the HiddenField not being populated
      form: 
        properties: 
          staticInfo: 
            $type: staticField
            label: "HiddenField Test"
            value: "Tests wether the HiddenField's defaultValue is being written to the JCR."
          standaloneHiddenFieldValue: 
            $type: hiddenField
            defaultValue: "This is supposed not to be written to the JCR."
          switchHiddenFieldValues: 
            label: "Switch hidden values"
            $type: switchableField
            itemProvider: 
              $type: currentItemProvider
            field: 
              $type: radioButtonGroupField
              defaultValue: hiddenValueOne
              datasource: 
                $type: optionListDatasource
                options: 
                  - value: hiddenValueOne
                    label: "Value One"
                  - value: hiddenValueTwo
                    label: "Value Two"
                  - value: EmptyHiddenValue
                    label: "No Value/Remove Value"
            forms: 
              - name: hiddenValueOne
                properties: 
                  hiddenValue: 
                    $type: hiddenField
                    defaultValue: "Value ONE, supposed to be written to JCR."
              - name: hiddenValueTwo
                properties: 
                  hiddenValue: 
                    $type: hiddenField
                    defaultValue: "Value TWO, supposed to be written to JCR."
              - name: EmptyHiddenValue
                properties: 
                  hiddenValue: 
                    $type: hiddenField
                    defaultValue: ""
                    description: "This is supposed to reset the hiddenValue. Idealy set it to null and remove the corresponding JCR-Item."
      footerLayout: 
        $type: defaultEditorActionLayout
        primaryActions: 
          commit: commit
        secondaryActions: 
          cancel: cancel
      

      This is cause because it uses the defaultValue Property.
      It would be nice if we could allow to set the value explicitly and override any existing one. 

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              ccantalapiedra Carlos Cantalapiedra
              Nucleus
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Task DoD