christianalfoni / formsy-react

A form input builder and validator for React JS
MIT License
2.6k stars 438 forks source link

Custom validate cannot be used with isValidValue #466

Open birjj opened 6 years ago

birjj commented 6 years ago

While components can have their own validate functions, said methods have no way of getting the value passed to isValidValue.

const MyOwnInput = React.createClass({
  mixins: [Formsy.Mixin],

  validate() { return !!this.getValue(); },

  test() {
    console.log(this.isValidValue(0)); // false
    console.log(this.isValidValue(1)); // false - should be true
  }

  // ...
});

JSFiddle