1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3207 from node-red/fix-debug-all

Fix TypedInput validation of type without options
This commit is contained in:
Nick O'Leary 2021-10-21 14:45:09 +01:00 committed by GitHub
commit c1d947ebe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -918,7 +918,7 @@
if ((opt.options && opt.hasValue !== true) || opt.hasValue === false) { if ((opt.options && opt.hasValue !== true) || opt.hasValue === false) {
if (this.oldValues.hasOwnProperty(opt.value)) { if (this.oldValues.hasOwnProperty(opt.value)) {
this.input.val(this.oldValues[opt.value]); this.input.val(this.oldValues[opt.value]);
} else { } else if (opt.options) {
// No old value for the option type. // No old value for the option type.
// It is possible code has called 'value' then 'type' // It is possible code has called 'value' then 'type'
// to set the selected option. This is what the Inject/Switch/Change // to set the selected option. This is what the Inject/Switch/Change
@ -936,6 +936,8 @@
this.input.val(""); this.input.val("");
} }
} }
} else {
this.input.val(opt.default||"")
} }
} else { } else {
this.input.val(this.oldValues.hasOwnProperty("_")?this.oldValues["_"]:(opt.default||"")) this.input.val(this.oldValues.hasOwnProperty("_")?this.oldValues["_"]:(opt.default||""))