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 013e5098c..db678e6b1 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 @@ -1543,7 +1543,7 @@ } } }, - validate: function() { + validate: function(options) { let valid = true; const value = this.value(); const type = this.type(); @@ -1580,7 +1580,10 @@ tooltip.delete(); } } - // Must return a boolean + if (options.returnErrorMessage === true) { + return valid; + } + // Must return a boolean for no 3.x validator return (typeof valid === "string") ? false : valid; }, show: function() { 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 e5247fbd8..72e3044e8 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 @@ -190,14 +190,9 @@ RED.editor = (function() { const input = $("#"+prefix+"-"+property); const isTypedInput = input.length > 0 && input.next(".red-ui-typedInput-container").length > 0; if (isTypedInput) { - valid = input.typedInput("validate"); - if (valid === false) { - // Try to find validation message in the tooltip - const tooltip = input.data("tooltip"); - if (tooltip) { - const content = tooltip.getContent(); - valid = label ? label + ": " + content : content; - } + valid = input.typedInput("validate", { returnErrorMessage: true }); + if (typeof valid === "string") { + valid = label ? label + ": " + valid : valid; } } }