Skip to content

v2.4.0

Compare
Choose a tag to compare
@akuzko akuzko released this 10 Oct 20:18
· 64 commits to master since this release

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'";
    }
  }]
});
// ...