mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix node validation if property is not required
This commit is contained in:
parent
1b5b3f7f88
commit
19a8fa09a8
@ -148,12 +148,23 @@ RED.editor = (function() {
|
|||||||
((typeof definition[property].label) == "string")) {
|
((typeof definition[property].label) == "string")) {
|
||||||
label = definition[property].label;
|
label = definition[property].label;
|
||||||
}
|
}
|
||||||
if ("required" in definition[property] && definition[property].required) {
|
if ("required" in definition[property]) {
|
||||||
valid = value !== "";
|
if (definition[property].required) {
|
||||||
if (!valid && label) {
|
valid = value !== "";
|
||||||
return RED._("validator.errors.missing-required-prop", {
|
if (!valid && label) {
|
||||||
prop: label
|
return RED._("validator.errors.missing-required-prop", {
|
||||||
});
|
prop: label
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (value === "") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (value === "") {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (valid && "validate" in definition[property]) {
|
if (valid && "validate" in definition[property]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user