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

Handle multiple-select box when nothing selected

Fixes #2021
This commit is contained in:
Nick O'Leary 2019-01-10 15:21:27 +00:00
parent f309a9d537
commit 9e47d933af
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1085,6 +1085,13 @@ RED.editor = (function() {
var input = $("#node-input-"+d); var input = $("#node-input-"+d);
if (input.attr('type') === "checkbox") { if (input.attr('type') === "checkbox") {
newValue = input.prop('checked'); newValue = input.prop('checked');
} else if (input.prop("nodeName") === "select" && input.attr("multiple") === "multiple") {
// An empty select-multiple box returns null.
// Need to treat that as an empty array.
newValue = input.val();
if (newValue == null) {
newValue = [];
}
} else if ("format" in editing_node._def.defaults[d] && editing_node._def.defaults[d].format !== "" && input[0].nodeName === "DIV") { } else if ("format" in editing_node._def.defaults[d] && editing_node._def.defaults[d].format !== "" && input[0].nodeName === "DIV") {
newValue = input.text(); newValue = input.text();
} else { } else {