From 57f03f2a530c5fd2abd2aa66a81d6fbd8fe1ea9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Jul 2021 00:00:08 +0200 Subject: [PATCH] Trigger explicitly change event when setting value The value set by mousetrap callback in the date input must trigger the change event such that the value is actually set to the record field. issue10578 review367281002 (grafted from 105f17a36c5cf22e2a6acdc389115cb25298e7e5) --HG-- branch : 6.0 --- src/view/form.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/view/form.js b/src/view/form.js index c8ebb68a21..c03b58202e 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -1649,7 +1649,8 @@ function eval_pyson(value){ mousetrap.bind('=', function(e, combo) { if (!this.date.prop('readonly')) { e.preventDefault(); - this.date.val(this._format(this.get_format(), moment())); + this.date.val(this._format(this.get_format(), moment())) + .change(); } }.bind(this)); @@ -1661,7 +1662,8 @@ function eval_pyson(value){ e.preventDefault(); var date = this.get_value() || Sao.DateTime(); date.add(operator[1]); - this.date.val(this._format(this.get_format(), date)); + this.date.val(this._format(this.get_format(), date)) + .change(); }.bind(this)); }.bind(this)); }, @@ -5012,11 +5014,11 @@ function eval_pyson(value){ mousetrap.bind('enter', function(e, combo) { var value = this._parse(this.format, this.input.val()); value = this._format(this.format, value); - this.input.val(value); + this.input.val(value).change(); }.bind(this)); mousetrap.bind('=', function(e, combo) { e.preventDefault(); - this.input.val(this._format(this.format, moment())); + this.input.val(this._format(this.format, moment())).change(); }.bind(this)); Sao.common.DATE_OPERATORS.forEach(function(operator) { @@ -5024,7 +5026,7 @@ function eval_pyson(value){ e.preventDefault(); var date = this.get_value() || Sao.DateTime(); date.add(operator[1]); - this.input.val(this._format(this.format, date)); + this.input.val(this._format(this.format, date)).change(); }.bind(this)); }.bind(this)); },