Default value not being displayed after upgrade to AEM 6.3 SP2

Avatar

Avatar
Validate 1
Level 1
JoniVanderheijd
Level 1

Likes

2 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
JoniVanderheijd
Level 1

Likes

2 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
JoniVanderheijd
Level 1

18-06-2018

We're upgrading to AEM 6.3 SP2, and we noticed something strange.

The default value for textfield input fields we use in authoring dialogs is no longer displayed.

We define our components like this:

   <exampleField

        jcr:primaryType="nt:unstructured"

        sling:resourceType="granite/ui/components/coral/foundation/form/textfield"

        fieldDescription="This is an example input field."

        fieldLabel="Example input label"

        name="./exampleField"

        value="Default value"/>

I've traced the issue to this line of code in the initialization of the field super type: (/libs/granite/ui/components/coral/foundation/form/field/init.jsp)

     String value = cmp.getValue().val(cmp.getExpressionHelper().getString(cfg.get("value", "")));

I did some debugging:

- cmp.getExpressionHelper().getString(cfg.get("value", "")) is correctly returning the default value string "Default value"

- cmp.getValue().val(<defaultValue>) seems to return null

I suspect cmp.getValue().val doesn't return the default value when no value is found for the textfield in./exampleField.

Any idea where I can have a look at the internal workings of the ComponentHelper or Value class? Or any other reasons why the default value wouldn't be displayed?

Thanks in advance!

Oh, and my session is running the 5.7.6-CQ630-B0007 version of the com.adobe.granite.ui.commons artifact.

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

19-06-2018

We spoke to suppoirt about this. They recommend opening a ticket as there appears to be an upgrade bug.

Avatar

Avatar
Validate 1
Level 1
JoniVanderheijd
Level 1

Likes

2 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
JoniVanderheijd
Level 1

Likes

2 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
JoniVanderheijd
Level 1

20-06-2018

Thank you, we created a ticket.

Avatar

Avatar
Validate 25
Level 3
alistairp781078
Level 3

Likes

10 likes

Total Posts

96 posts

Correct reply

5 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 10
Give Back 5
View profile

Avatar
Validate 25
Level 3
alistairp781078
Level 3

Likes

10 likes

Total Posts

96 posts

Correct reply

5 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 10
Give Back 5
View profile
alistairp781078
Level 3

24-09-2018

TheRealJoni​ Did you hear back about a bug fix for this? We have recently installed SP2 and are having the same issue.

Alistair

Avatar

Avatar
Validate 1
Level 1
JoniVanderheijd
Level 1

Likes

2 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
JoniVanderheijd
Level 1

Likes

2 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
JoniVanderheijd
Level 1

24-09-2018

Hello Alistair,

Adobe came back to us that this change was intentional and this is behavior as expected.

We implemented a work-around by overwriting these two files:

granite/ui/components/foundation/form/field/init.jsp

granite/ui/components/coral/foundation/form/field/init.jsp

String value = cmp.getValue().val(cmp.getExpressionHelper().getString(cfg.get("value", "")));

// START - Work-around for default value bug

if (value == null) {

value = cmp.getExpressionHelper().getString(cfg.get("value", ""));

}

// END - Work-around for default value bug

ValueMap vm = new ValueMapDecorator(new HashMap<String, Object>());

vm.put("value", value);

I hope this helps you!

I’m switching to a different way of setting default values though, because this work-around feels wrong to me. I’m using cq:template to set default values for new code.

Kind regards,

Joni

Avatar

Avatar
Validate 25
Level 3
alistairp781078
Level 3

Likes

10 likes

Total Posts

96 posts

Correct reply

5 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 10
Give Back 5
View profile

Avatar
Validate 25
Level 3
alistairp781078
Level 3

Likes

10 likes

Total Posts

96 posts

Correct reply

5 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 10
Give Back 5
View profile
alistairp781078
Level 3

25-09-2018

Thanks for the help, Joni.

I like your second solution of adding default values into the template so think I will go with that for now and see how I get on.

Alistair

Avatar

Avatar
Level 1
billm12174916
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile

Avatar
Level 1
billm12174916
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile
billm12174916
Level 1

24-10-2018

I just want to clarify what I am reading here.

Adobe broke the default value functionality, said they did it on purpose and now we have to code around their bug to make it work again?  

Really?