[DOCU-1095] Explain the behaviour of defaultValue and selected properties when item is new and when it's not Created: 03/Aug/17  Updated: 20/Apr/18  Resolved: 20/Apr/18

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Federico Grilli Assignee: Martin Drápela
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
documentation
documents MGNLUI-4264 Switchable Field default selection do... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:
Sprint: Docu Sprint 48
Story Points: 3

 Description   

This seems to be an issue which often confuses customers (and core devs as well, sometimes ).
Basically defaultValue and/or selected options are only applied for new items, not for existing ones.

Quoting Mika:

"Default values are only applied when the item is new.

What would happen if we applied default values for existing items?
Authors could open the dialog, see the default value, and decide to simply close/cancel the dialog without realising that value is not saved.

It does not matter if the dialog definition changed.

Generally, when modifying dialog definitions, it might be a good idea to combine that with a new delta task, in the version handler; or at least with a groovy script (where then you can apply a default value to pre-existing content)."



 Comments   
Comment by Martin Drápela [ 20/Apr/18 ]

Added an info line to the selected property @:

https://documentation.magnolia-cms.com/display/DOCS56/Switchable+field
https://documentation.magnolia-cms.com/display/DOCS55/Switchable+field
https://documentation.magnolia-cms.com/display/DOCS54/Switchable+field

Additionally fixed a typo there and changed label: Rich text > label: Rich in the config above so that it matches the screenshots.

Comment by Federico Grilli [ 20/Apr/18 ]

Thank you. Looks good. Only I would add the same info to defaultValue at https://documentation.magnolia-cms.com/display/DOCS56/Field+definition (and their counterparts for 5.5.x and 5.4.x branches)

Generated at Mon Feb 12 01:15:06 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.