Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

On/Off time(datetime field) doesn't cleared after cancel button is pressed | AEM Community Blog Seeding

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,158 likes

Total Posts

6,255 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,158 likes

Total Posts

6,255 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

26-05-2020

BlogImage.jpg

On/Off time(datetime field) doesn't cleared after cancel button is pressed by howtoaem Blog

Abstract

On/Off time(datetime field) doesn't cleared after cancel button is pressed
I open page properties and fill some fields

After I pressed cancel button, and reopened properties dialog, all field cleared, but datetime fields didn't.

What is the rigth way to clear datetime fields?
Best How To:
I was debuggin and find out strange behavior of isApplyDefault method in \ibs\cq\ui\widgets\source\ext\override\widgets\form\Field.js. It is compare created and modefied date, if they equals returns true, otherwise false.
I just ovveride method processRecord in DateTime.js to remove calling isApplyDefault:

processRecord: function(record, path) {
if (this.fireEvent('beforeloadcontent', this, record, path) !== false) {
var v = record.get(this.getName());
if (v == undefined && this.defaultValue != null) {
this.setValue(this.defaultValue);
}
else {
this.setValue(v);
}
this.fireEvent('loadcontent', this, record, path);
}
}
in Field.js it is:

processRecord: function(record, path) {
if (this.fireEvent('beforeloadcontent', this, record, path) !== false) {
var v = record.get(this.getName());
if (v == undefined && this.defaultValue != null) {
if (this.isApplyDefault(record, path)) {
this.setValue(this.defaultValue);
}
}
else {
this.setValue(v);
}
this.fireEvent('loadcontent', this, record, path);
}
}

Read Full Blog

On/Off time(datetime field) doesn't cleared after cancel button is pressed

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager