mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Don't use the typedInput tooltip to get the validation message
This commit is contained in:
parent
6aae50294f
commit
34ed9c5cd8
@ -1543,7 +1543,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validate: function() {
|
validate: function(options) {
|
||||||
let valid = true;
|
let valid = true;
|
||||||
const value = this.value();
|
const value = this.value();
|
||||||
const type = this.type();
|
const type = this.type();
|
||||||
@ -1580,7 +1580,10 @@
|
|||||||
tooltip.delete();
|
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;
|
return (typeof valid === "string") ? false : valid;
|
||||||
},
|
},
|
||||||
show: function() {
|
show: function() {
|
||||||
|
@ -190,14 +190,9 @@ RED.editor = (function() {
|
|||||||
const input = $("#"+prefix+"-"+property);
|
const input = $("#"+prefix+"-"+property);
|
||||||
const isTypedInput = input.length > 0 && input.next(".red-ui-typedInput-container").length > 0;
|
const isTypedInput = input.length > 0 && input.next(".red-ui-typedInput-container").length > 0;
|
||||||
if (isTypedInput) {
|
if (isTypedInput) {
|
||||||
valid = input.typedInput("validate");
|
valid = input.typedInput("validate", { returnErrorMessage: true });
|
||||||
if (valid === false) {
|
if (typeof valid === "string") {
|
||||||
// Try to find validation message in the tooltip
|
valid = label ? label + ": " + valid : valid;
|
||||||
const tooltip = input.data("tooltip");
|
|
||||||
if (tooltip) {
|
|
||||||
const content = tooltip.getContent();
|
|
||||||
valid = label ? label + ": " + content : content;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user