[MGNLUI-7186] HiddenFields do not update its value once set Created: 31/May/22  Updated: 28/Jun/22

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

Type: Improvement Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
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)
Epic Link: Maintenance of vaadin8 framework
Team: Nucleus

 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. 


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