changeset fe4e608239f2 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=fe4e608239f2
description:
Keep showing invalid input number and set NaN on the model
When a dialog (form) is validated and show the error message from the
browser,
the input number must be visible.
Also we should not store on the model invalid values to get error on
client
side instead of the server side.
issue8487
review255661002
diffstat:
src/view/form.js | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (29 lines):
diff -r 27f3025172fe -r fe4e608239f2 src/view/form.js
--- a/src/view/form.js Wed Jul 17 22:47:32 2019 +0200
+++ b/src/view/form.js Wed Jul 17 22:48:59 2019 +0200
@@ -1591,8 +1591,10 @@
input.attr('lang', Sao.i18n.getlang());
input.hide().on('focusout', function() {
- input.hide();
- input_text.show();
+ if (input[0].checkValidity()) {
+ input.hide();
+ input_text.show();
+ }
});
input_text.on('focusin', function() {
if (!input.prop('readonly')) {
@@ -1626,7 +1628,11 @@
this.record, this.get_value(), undefined, this.factor);
},
get_value: function() {
- return this.input.val();
+ if (this.input[0].checkValidity()) {
+ return this.input.val();
+ } else {
+ return NaN;
+ }
},
get_client_value: function() {
var value = '';