按下取消按钮后,开/关时间(日期时间字段)不会清除

时间:2022-12-09 09:42:09

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?

清除日期时间字段的方法是什么?

1 个解决方案

#1


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.

我是debuggin并在\ ibs \ cq \ ui \ widgets \ source \ ext \ override \ widgets \ form \ Field.js中找出isApplyDefault方法的奇怪行为。它是比较创建和模拟日期,如果它们等于返回true,否则为false。

I just ovveride method processRecord in DateTime.js to remove calling isApplyDefault:

我只是在DateTime.js中使用ovveride方法processRecord来删除调用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:

在Field.js中它是:

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);
    }
}

See also in adobe forum

另见adobe论坛

#1


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.

我是debuggin并在\ ibs \ cq \ ui \ widgets \ source \ ext \ override \ widgets \ form \ Field.js中找出isApplyDefault方法的奇怪行为。它是比较创建和模拟日期,如果它们等于返回true,否则为false。

I just ovveride method processRecord in DateTime.js to remove calling isApplyDefault:

我只是在DateTime.js中使用ovveride方法processRecord来删除调用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:

在Field.js中它是:

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);
    }
}

See also in adobe forum

另见adobe论坛