Redux form successful async validation -


redux form async validation quite nice, want somehow indicate asynchronous validation has succeeded. want:

  1. field empty, don't show async success
  2. field getting filled, normal sync validation happening, don't show async success
  3. field loses focus, async validation starts, don't show async success
  4. a) async validation returns error, show it
  5. b) async validation succeeds, show async success

however have asyncvalidating prop, , can't change local state in render method. dispatch redux action , keep every field async success state, use redux-form avoid managing form state myself.

i've hacked a little example here, passing "true" error value , showing "success" message when async validation passes.

ah, missed this one.

const usernamehasvalidated =   username.touched && // field has been visited , blurred   username.valid &&   // field has no error   !asyncvalidating;   // not validating 

works fine.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -