In the process of creating a promised-based validation, I initially came up with the following approach:
export namespace Constraints {
function required(value: any, vm: any, customParams: RequiredParams);
function minLength(value: any, vm: any, customParams: LengthParams);
function maxLength(value: any, vm: any, customParams: LengthParams);
}
const ConstraintsInForm = {
fields: {
login: [
{ validator: Constraints .required },
],
password: [
{ validator: Constraints .required },
events: { onChange: true, onBlur: true },
]
}
};
I am in need of an example demonstrating how to create my own promised based validation using the provided constraints and field values.
The objective is to ensure flexibility within constraintsInForm so that with just a method call, I can obtain the corresponding errors dynamically.