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
1 changed files with 7 additions and 0 deletions

View File

@ -1085,6 +1085,13 @@ RED.editor = (function() {
var input = $("#node-input-"+d);
if (input.attr('type') === "checkbox") {
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") {
newValue = input.text();
} else {