Hi Team,
I need to validate 'Amount' field as not having -ve number. But if this field is hidden, then this validation should not work.
------------------------------------------------------------------------------------------------------------------
"validators": {
"ValidateFieldValue": {
"type": "usr.ValidateAmountForPositiveValue",
"params": {
"message": "Amount must be greater than 0(Zero)."
}
}
}
"usr.ValidateAmountForPositiveValue": {
"validator": function (config) {
return function (control) {
if (visibilityProperty && control.value < 0) {
return {
"usr.ValidateAmountForPositiveValue": {
message: config.message
}
};
}
};
},
/* Validator parameters. */
"params": [
{
"name": "message"
}
],
"async": false
}
------------------------------------------------------------------------------------------------------------------
Query: How can I get this `visibilityProperty` of field & use it in validator?
(I've used Business Rule to show/hide element instead of custom attribute)