AEM 6.1 Touch UI: Datepicker Field not prepopulated with stored value | Community
Skip to main content
March 14, 2017
Solved

AEM 6.1 Touch UI: Datepicker Field not prepopulated with stored value

  • March 14, 2017
  • 8 replies
  • 9380 views

Hi!

 

I'm currently facing a strange issue:

I've a component that includes text inputs and a date picker (Resource Type: granite/ui/components/foundation/form/datepicker).

I can add and edit values for all input fields and they are shown properly on the component on the edited webpage.

The system also stores all values properly.

 

But when I re-open the dialog the value for the date selected via date picker is not shown. The date picker input field remains empty.

All other inputs are prepopulated with the stored values.

The date is shown on the component but not in the date picker.

If I save the dialog with the empty date picker value the date will be overwritten with null.

 

Any idea what I can do to show the entered date there?

 

Thanks and best regards

Sebastian

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by vinayk70574604

Ah ok, you are using type="date" (the first property of your datepicker) this is what i meant.

I see your problem, you are using just type=date but by default this is storing in date-time format and thats why the dialog is not able to display the value.

2 Solutions-

1. If you want to retain type="date", have the additional property storedValue something like storedValue="YYYY-MM-DD" make sure you are not specifying time

2. change type="datetime", you don't need to specify the storedValue property in this case, and this lets you specify the time too.

Observe the content node for the stored value. You can use the properties accordingly for display purpose.

8 replies

Level 2
March 14, 2017

Hi Sebastian,

Have you specified the displayedFormat property?

Like: displayedFormat=YYYY-MM-DD

Which type are you using date, datetime, time,...?

March 14, 2017

Hi Vinay,

 

these are the properties of the datepicker:

type=date (string)

displayedFormat=YYYY-MM-DD (string)

jcr:primaryType=nt:unstructured (name)

name=./jcr:startdate (string)

sling:resourceType=granite/ui/components/foundation/form/datepicker (string)

fieldLabel=Start Date (string)

fieldDescription=Enter Start Date (string)

 

I'm using "java.util.Date startdate = properties.get("jcr:startdate", java.util.Date.class);" to get the input and use it in my JSP component file.

This is an example output of the startdate value without any formatting: Tue Mar 28 00:00:00 CEST 2017

 

I don't see any further information about the date type itself whether it's date, datetime or time.

 

Thanks

Sebastian

vinayk70574604Accepted solution
Level 2
March 14, 2017

Ah ok, you are using type="date" (the first property of your datepicker) this is what i meant.

I see your problem, you are using just type=date but by default this is storing in date-time format and thats why the dialog is not able to display the value.

2 Solutions-

1. If you want to retain type="date", have the additional property storedValue something like storedValue="YYYY-MM-DD" make sure you are not specifying time

2. change type="datetime", you don't need to specify the storedValue property in this case, and this lets you specify the time too.

Observe the content node for the stored value. You can use the properties accordingly for display purpose.

March 14, 2017

Thanks-a-lot for your help, Vinay. Problem solved.

Level 2
May 19, 2017

Hi REES,

I am having the same issue with the datepicker.  Below is how the datepicker is configured. I tried using type="date" but still no use. It works if i use type="datetime" but i want to use date only so can you please provide some information on how you were able to solve the issue?

<articleDate   fieldLabel="Date"   name="./articleDate"   sling:resourceType="granite/ui/components/foundation/form/datepicker"   displayedFormat="MMM-DD-YYYY"   valueFormat="YYYY-MM-DD"   storedValue="YYYY-MM-DD"   jcr:primaryType="nt:unstructured"/>
Level 2
June 1, 2017

It was a bug, which has been fixed in CFP7.

NPR-15384: HotFix for GRANITE-16481

Here is the link. Adobe Experience Manager Help | Release Notes: AEM 6.1 Cumulative Fix Pack

The issue is only in chrome browser.

Thanks,

Thilak

ebin_Aby
Level 2
August 10, 2017

how can we get the value in htl ?

${properties.articleDate} does not work . I would need time and date .

i don't want to create a java class to read this datetime node . Is there any other way in 6.1 ?

thilaks18944609
Level 2
August 12, 2017

try this:

${properties.articleDate.getTime.toString}