defaultValue property removed in coral numberfield in AEM 6.4?

Avatar

Avatar

sundarig9086821

Avatar

sundarig9086821

sundarig9086821

10-01-2019

Hi,

We are facing issue in making numberfield change from granite/ui/components/foundation/form/numberfield to granite/ui/components/coral/foundation/form/numberfield in AEM6.4.

As per this document, NumberField — Granite UI 1.0 documentation  the defaultValue property has been removed for 6.4

However the property exists for 6.3 -- NumberField — Granite UI 1.0 documentation 

How can we achieve Coral numberfiled along with defaultProperty in AEM 6.4?

smacdonald2008Arun Patidar​ any help on this?

Thanks in advance!!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

NegiCF

Avatar

NegiCF

NegiCF

14-01-2019

HI @sundarig90868210

You can achieve the same by using @DefualtValue.

Try the below:-

<number

                        jcr:primaryType="nt:unstructured"

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

                        fieldDescription="Value of Product"

                        fieldLabel="Page value"

                        name="./testValue"/>

<number-default

                        jcr:primaryType="nt:unstructured"

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

                        name="./testValue@DefaultValue"

                        value="{Long}11"/>

Make sure name property remain the same with @DefaultValue appended in the hidden one.

Answers (7)

Answers (7)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

879

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

879
Arun_Patidar
MVP

10-01-2019

Hi,

The value property values only persist if jcr:created and jcr:lastModified date is same for a component node in content.

That means once component is authored, the dialog values will be fetched from save properties.

If you always need value property in case of empty you can add data attribute using granite:data node and set any property with default value and with the help of javascript on dialog load you can check if number filed is empty you can fill it from data attribute value.

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

879

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

879
Arun_Patidar
MVP

10-01-2019

Hi

Use "value" property insteadof "defaultValue" .

Avatar

Avatar

sundarig9086821

Avatar

sundarig9086821

sundarig9086821

15-01-2019

Hi NegiCF​,

Thanks fo the solution. It worked.

Is this the proper way of defining defaultvalue in numberfield from 6.4 or is there any other reason for removal of delaultValue property from coral-numberfield?

Thanks,
Sundari.

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

10-01-2019

that is because you removed the value. If you remove the value - it's gone.

Avatar

Avatar

sundarig9086821

Avatar

sundarig9086821

sundarig9086821

10-01-2019

Hi Arun Patidar​,

I have tried your approach.

And there is one issue related to value property.

I gave value for coral numberfield.

1665008_pastedImage_0.png

After when i use this component in page, in dialog i am able to see the value initially.

1665009_pastedImage_1.png

After that i have authored with some value and saved it. If i open the dialog again and removed the authored value and save it again the value(which is supposed to be displayed) is not appearing in dialog.

Authored value:

1665010_pastedImage_2.png

Removed the authored value and opened the dialog again :

1665011_pastedImage_3.png

The value is not displaying.

Any help on this?

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

10-01-2019

Nice suggestion - I am going to test this later today.

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

10-01-2019

I am checking with the Touch UI team to see what is happening here.