foxhound87
9/3/2017 - 9:56 PM

[mobx-react-form] hooks

[mobx-react-form] hooks

const hooks = {
  
  onSuccess(form) {
    alert('Form is valid! Send the request here.');
    // get field values
    console.log('Form Values!', form.values());
  },

  onError(form) {
    // get all form errors
    console.log('All form errors', form.errors());
    // invalidate the form with a custom error message
    form.invalidate('This is a generic error message!');
  },

};