From b43b844916a61497f2b16659b75c77dc14a07091 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 7 Nov 2020 11:23:29 +0100 Subject: [PATCH] input: apply default value when receiving an empty value or no value at all --- CHANGELOG.md | 1 + src/client/widgets/basics/input.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71eaceba..25857207 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - bug fixes - matrix: issues when changing non-dynamic properties (content not properly removed) + - input: apply default value when receiving an empty value or no value at all ## 1.6.1 diff --git a/src/client/widgets/basics/input.js b/src/client/widgets/basics/input.js index eac66e36..41960923 100644 --- a/src/client/widgets/basics/input.js +++ b/src/client/widgets/basics/input.js @@ -126,6 +126,8 @@ class Input extends Canvas { this.value = v } + if (this.value === '' || this.value === null) this.value = this.getProp('default') + this.stringValue = this.getStringValue() this.batchDraw()