From d695cf392eebd4006d1c6a7b67e1d66d06e46d2e Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 21 Oct 2021 14:44:15 +0100 Subject: [PATCH] Fix TypedInput validation of type without options Fixes #3206 --- .../@node-red/editor-client/src/js/ui/common/typedInput.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js index ba7e48900..e44a90dc6 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js @@ -918,7 +918,7 @@ if ((opt.options && opt.hasValue !== true) || opt.hasValue === false) { if (this.oldValues.hasOwnProperty(opt.value)) { this.input.val(this.oldValues[opt.value]); - } else { + } else if (opt.options) { // No old value for the option type. // It is possible code has called 'value' then 'type' // to set the selected option. This is what the Inject/Switch/Change @@ -936,6 +936,8 @@ this.input.val(""); } } + } else { + this.input.val(opt.default||"") } } else { this.input.val(this.oldValues.hasOwnProperty("_")?this.oldValues["_"]:(opt.default||""))