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 332f41fa9..5a6794732 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 @@ -342,7 +342,7 @@ this.input.on('change', function() { that.validate(); that.element.val(that.value()); - that.element.trigger('change',that.propertyType,that.value()); + that.element.trigger('change',[that.propertyType,that.value()]); }); this.input.on('keydown', function(evt) { if (evt.keyCode >= 37 && evt.keyCode <= 40) { @@ -606,7 +606,7 @@ } if (opt.hasValue) { this.optionValue = o.value; - this.input.trigger('change',this.propertyType,this.value()); + this.input.trigger('change',[this.propertyType,this.value()]); } } else { this.optionSelectLabel.text(o.length+" selected"); @@ -699,7 +699,7 @@ opt.valueLabel.call(this,this.valueLabelContainer,value); } } - this.input.trigger('change',this.type(),value); + this.input.trigger('change',[this.type(),value]); } }, type: function(type) { @@ -864,7 +864,7 @@ }); } this._trigger("typechange",null,this.propertyType); - this.input.trigger('change',this.propertyType,this.value()); + this.input.trigger('change',[this.propertyType,this.value()]); } else { if (this.optionSelectTrigger) { this.optionSelectTrigger.hide(); @@ -934,7 +934,7 @@ } } this._trigger("typechange",null,this.propertyType); - this.input.trigger('change',this.propertyType,this.value()); + this.input.trigger('change',[this.propertyType,this.value()]); } } } diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js index 82a81da95..8882d971e 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js @@ -356,14 +356,14 @@ RED.editor = (function() { function attachPropertyChangeHandler(node,definition,property,prefix) { var input = $("#"+prefix+"-"+property); if (definition !== undefined && "format" in definition[property] && definition[property].format !== "" && input[0].nodeName === "DIV") { - $("#"+prefix+"-"+property).on('change keyup', function(event,skipValidation) { - if (!skipValidation) { + $("#"+prefix+"-"+property).on('change keyup', function(event,) { + if (!$(this).attr("skipValidation")) { validateNodeEditor(node,prefix); } }); } else { $("#"+prefix+"-"+property).on("change", function(event,skipValidation) { - if (!skipValidation) { + if (!$(this).attr("skipValidation")) { validateNodeEditor(node,prefix); } }); @@ -476,13 +476,27 @@ RED.editor = (function() { // to prevent full node validation from being triggered each time for (var d in definition.defaults) { if (definition.defaults.hasOwnProperty(d)) { - $("#"+prefix+"-"+d).trigger("change",[true]); + var el = $("#"+prefix+"-"+d); + el.attr("skipValidation", true); + if (el.data("noderedTypedInput") !== undefined) { + el.trigger("change",[el.typedInput('type'),el.typedInput('value')]); + } else { + el.trigger("change"); + } + el.removeAttr("skipValidation"); } } if (definition.credentials) { for (d in definition.credentials) { if (definition.credentials.hasOwnProperty(d)) { - $("#"+prefix+"-"+d).trigger("change",[true]); + var el = $("#"+prefix+"-"+d); + el.attr("skipValidation", true); + if (el.data("noderedTypedInput") !== undefined) { + el.trigger("change",[el.typedInput('type'),el.typedInput('value')]); + } else { + el.trigger("change"); + } + el.removeAttr("skipValidation"); } } }