Unable to clear inherited property

Description

When you want to clear the property of an inherited field and keep inheriting all the rest, we are unable to do so unless via crx - the editor seems to turn this into null causing the inheritance to be restored instead of saving it as empty string

By example - we go from:
Step 1: inherited configuration we want to clear a property for

Step 2: clearing the property while keeping the rest in place

Step 3: revisiting the configuration - we see it restored the inheritance

This is a fairly common use case for 'global site settings' for example where we want to remove some specific settings for a subsite or a specific page hierarchy

Activity

Show:
Stefan Seifert
March 22, 2019, 8:14 AM

this can be easily reproduced with our sample content e.g.
http://localhost:4502/content/contextaware-config-sample/en/sub-page/config.html#/io.wcm.caconfig.sample.config.ConfigSample

it's not possible to set "string param" to an empty value - it then set to inherited back again.
the same effect occurs if "string param" is set to a string with 1 space (" ").

maybe it would be possible to distinguish between null (=inherit) and empty string ("" or any number of blanks)?

David Ding
April 29, 2019, 11:12 PM

- I have pushed a change to the feature/WCON-66_clear-inherited branch.

This allows empty strings values and empty arrays to be posted (these were previously "converted" to null), allowing for the "clearing" of inherited properties.

Is this the desired behaviour?

TODO - this method will not work for Integer/Long/Double values, as the backend will reject an empty string for properties of this type.

If/when this back-end "accepts" empty strings as "clearing" values, lines 145-147 could be deleted.

Stefan Seifert
April 30, 2019, 12:16 AM
Edited

yes, this solution looks good to me.

in case of other data types:

  • there is no equivalent for an empty strings for numbers or the other data types

  • so in this case the backend accepts only null or a real value

  • in this case the previous behavior should be applied - either overriding with a new value entered, or it inherits

David Ding
April 30, 2019, 8:42 PM
Stefan Seifert
April 30, 2019, 9:48 PM

thanks, it's merged

Fixed

Assignee

Unassigned

Reporter

Bart Wulteputte

Labels

None

Components

Priority

Minor