[MGNLUI-2396] defaultValue does not work in Area Dialogs Created: 14/Nov/13  Updated: 15/Apr/16  Resolved: 04/Dec/15

Status: Closed
Project: Magnolia UI
Component/s: dialogs
Affects Version/s: 5.1.1, 5.3.3, 5.4.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Tom Wespi Assignee: Ngoc Nguyenthanh
Resolution: Workaround exists Votes: 2
Labels: support
Remaining Estimate: 1d 4.5h
Time Spent: 1d 3.5h
Original Estimate: 3d

Issue Links:
Relates
relates to PAGES-40 Default values do not work when editi... Closed
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)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Saigon 22
Story Points: 3

 Description   

If the dialog is called from a component, defaultValue is working.

Tested on demoauthor.magnolia-cms.com



 Comments   
Comment by Eric Hechinger [ 15/Jul/14 ]

(Tested on 5.3)

  • add an option default selected: /modules/standard-templating-kit/dialogs/generic/controls/tabImage/fields/imageLocation/options/above@selected = true
  • add a textfield default value : /modules/standard-templating-kit/dialogs/generic/controls/tabImage/fields/imageCopyright@defaultValue = Magnolia
  • go to .magnolia/admincentral#app:pages:detail;/demo-project/about/subsection-articles/article:edit and add a TextImage component:

you will see the default values in the Tab Image

Comment by Ngoc Nguyenthanh [ 03/Dec/15 ]

zdenekskodik Could you please add more detail how to reproduce this bug?

Comment by Tom Wespi [ 03/Dec/15 ]

I couldn't reproduce this bug with 5.4.3 and YAML neither.

Comment by Zdenek Skodik [ 03/Dec/15 ]

At a magnolia-enterprise-pro-stk-5.4.3 you can set /pages/article/stkArticleIntro/form/tabs/tabMain/fields/author@defaultValue=you, render /demo-project/about/history and try to edit the intro.

Comment by Mikaël Geljić [ 04/Dec/15 ]

So this is indeed a *non-optional* area.

Page and [non-optional] area nodes are created and edited in two distinct steps, so we don't know when they are actually new, and thus don't apply default values from the field definition.

Just like when we tackled PAGES-40, we decided to stay away from crafting yet another mechanism for default-values in UI forms, at least not under maintenance (more details here).
However, there is a workaround, as Espen suggested on PAGES-40: use auto-generation.

In your particular case w/ STK, the area doesn't have its own node, and auto-generation is not supported on page level. So you would have first to set createAreaNode to true in the STK prototype, for the main area so that it processes auto-generation, and for the sub-area, so that generator can create the node (or alternatively, use a custom Generator).

So meanwhile I'll be resolving this ticket as `Workaround exists`, if I may.

Cheers,

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