[MGNLUI-6767] DOC: Clarify interaction between defaultValue and populate Created: 08/Jun/21  Updated: 06/Jul/21  Resolved: 06/Jul/21

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

Type: Improvement Priority: Neutral
Reporter: Michael Duerig Assignee: Ashraf Khamis
Resolution: Done Votes: 0
Labels: actions, dialogs, fields
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

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)
Date of First Response:
Epic Link: UI framework implementation
Sprint: UI FW 31
Story Points: 2

 Description   

The populate property of the openDialogAction interacts with the defaultValue of select fields in non obvious ways: to apply the default value of a radio button group field, setting defaultValue alone is not sufficient and populate=false needs also be set on the corresponding open dialog action. I suggest we improve the documentation to that respect.

The documentation of defaultValue has the note "Applied only when creating a new item, not for already existing items", which could be related. No mention of the populate property though.

The documentation of OpenDialogActionDefinition mentions the populate property but stays very vague: "can trigger exceptions in some cases".

Note that I don't have the full picture on how and where the populate and defaultValue properties interact. Maybe rkovarik has more insight and can help with the details.

Note

This was discovered in the ABn testing app where setting the default value alone did not selected the "now" option until populate was set to false in the open dialog action.



 Comments   
Comment by Roman Kovařík [ 06/Jul/21 ]

 The populate property of the openDialogAction interacts with the defaultValue of select fields...

The field type actually doesn't matter.
What matters is if we want to use the dialog to create (we don't want to populate as the item doesn't exist yet) or edit (we want to populate with existing values).
 

Comment by Ashraf Khamis [ 06/Jul/21 ]

Added another note to the defaultValue property at https://docs.magnolia-cms.com/product-docs/6.2/Templating/Dialog-definition/Field-definition.html#_common_simple_field_properties and updated the note for OpenDialogActionDefinition at https://docs.magnolia-cms.com/product-docs/6.2/Apps/App-configuration/Action-definition.html#_general_action_definition_classes.

Reviewed by Roman.

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