Don't use the typedInput tooltip to get the validation message

This commit is contained in:
GogoVega 2024-06-03 18:41:40 +02:00
parent 6aae50294f
commit 34ed9c5cd8
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B
2 changed files with 8 additions and 10 deletions

View File

@ -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() {

View File

@ -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;
}
}
}