Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form.forceValidate() doesn't work #12

artkravchenko opened this issue Jul 3, 2016 · 2 comments


Copy link

@artkravchenko artkravchenko commented Jul 3, 2016

Let's consider the situation when we have handleSubmit() like this:

handleSubmit = (e) => {
  const { form } = this.props;

  form.forceValidate(); // (doesn't validate!)
  if (!form.isValid()) {

  // submitting...

  form.onValues({}); // clean the form
  form.forceValidate(); // (also doesn't validate)

The problem is that form.forceValidate() at the end of the function doesn't work: validation function won't be called. So, the form "is still valid" - you can try to submit again... All will be ok, forceValidate() at the beginning of the function also doesn't work -> form.isValid() returns true. The form'll be validated only after real change like passing a character to its field. form.onValues() doesn't cause validation.

What's the purpose of form.forceValidate(), if it doesn't validate the form?
Why doesn't form.onValues() cause the validation, like common form changes?


This comment has been minimized.

Copy link

@theadam theadam commented Jul 3, 2016

forceValidate is perhaps incorrectly named. The form should always be keeping an up to date internal validation state, but that state is only passed to the UI after the fields are "touched" (technically onblur). This functionality is working as designed.

The issue, however, seems to be that onValues is not updating the form's values in a way that would update the internal error state of the fields. onValues should be using the form's setValues method, but its not, its calling setState directly.


This comment has been minimized.

Copy link

@theadam theadam commented Jul 24, 2016

fixed by #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.