Hello Everyone,
I'm tryng to validate a value of an editable list based on the value of a checkbox of the node, is it possible ?
I'd like to check if value3 is not " " only if the checkbox duplicates is checked.
here's the code:
defaults: {
name: { value: "" },
table1: {
value: "",
required: true,
},
table2: {
value: "",
required: true,
},
joinType: {
value: "INNER JOIN",
required: true,
},
distinct: {
value: false,
required: false,
},
duplicates: {
value: false,
required: false,
},
outputName: { value: "" },
props: {
// Entry containing all the items of the list
value: [
// Default items in the list
...DEFAULT_LIST_VALUES_JOIN,
],
validate: function (v, opt) {
for (var i = 0; i < v.length; i++) {
// Items name must not be null or empty
if (v[i].value1 === undefined || v[i].value1 === "" || v[i].value2 === undefined || v[i].value2 === "")
return RED._(
"@sss/node-red-sss-joinmatrix/joinmatrix:join.errors.invalid-name"
);
if (v[i].value3 === undefined || v[i].value3 === "")
return RED._(
"@sss/node-red-sss-joinmatrix/joinmatrix:join.errors.invalid-rename"
);
}