From 77f6c00cadd173bc2cdc8560afd134aa924fee52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 17 Jul 2019 22:48:59 +0200 Subject: [PATCH] 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 --- src/view/form.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/view/form.js b/src/view/form.js index 77efd2933c..68c9a79bdd 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -1591,8 +1591,10 @@ function eval_pyson(value){ 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 @@ function eval_pyson(value){ 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 = '';