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

readOnly checkbox doesn't appear in JCR data

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Neutral
    • Resolution: Fixed
    • Affects Version/s: 5.4.9, 5.5
    • Fix Version/s: 5.4.12, 5.5.3
    • Component/s: forms
    • Labels:
      None
    • Sprint:
      Kromeriz 84
    • Story Points:
      8
    • Magnolia Release:
      5.4.12, 5.5.3

      Description

      Thanks to Soisik Froger in SUPPORT-6874, currently when user set field's config 'readOnly' to 'true', our 'defaultValue' is no longer used when populating its value. This issue leads to no value saved into their JCR persistent.
      Expected result: Separate logic of 'defaultValue' and 'readOnly' in fields which means:
      1. When a field is readOnly, make it read only from editors.
      2. When user set its 'defaultValue', put that value to field's value.
      Grep code:

      info.magnolia.ui.form.field.factory.AbstractFieldFactory.setPropertyDataSourceDefaultValue(Property) {
          ...
          if (defaultValue != null && !definition.isReadOnly()) {
              ....
              property.setValue(defaultValue);
          }
      }
      

      Solution:
      Keep Transformer unaware of definition #readOnly state, only mirror that of the underlying data-source

      • Let FieldFactory set defaultValue even if definition is readOnly, but not if underlying property is
      • Keep setting field as read-only based on the definition, only at the end of the chain in #setConstraints
      • Document Transformer#isReadOnly with intent, and deprecate setter
      • In particular, Transformer must not affect the underlying property's read-only state
      • Add test from Evzen
      • De-abstract BasicTransformer property instantiation for initial value vs. cross-type override (while retaining read-only state);
      • Apply lessons learned from BasicTransformer to FileTransformer

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                efochr Evzen Fochr
                Reporter:
                viet.nguyen Viet Nguyen
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 1.25d
                  1.25d