Release Description
- When calling input validator, form will pass it's attributes as
attrs
option and name of the input being validated as name
option by default. This allows to declare custom wildcard validations that depend on other form attributes. For example:
const {$, withValidation} = useForm({name: "", items: []}, {
"name": "presence",
"items.*.start": "presence",
"items.*.end": ["presence", function(value, {name, attrs}) {
const index = name.split(".")[1];
if (+value < +attrs.items[index].start) {
return "Should be greater than 'Start'";
}
}]
});
// ...