NewOldMax / react-form-validator-core

Core validator component for react forms
MIT License
95 stars 44 forks source link

@NewOldMax please check this [https://codesandbox.io/s/distracted-smoke-0gvf9](link) . I want both input field dependent to each other. #54

Closed DeepakM02 closed 5 years ago

DeepakM02 commented 5 years ago

@NewOldMax please check this link . I want both input field dependent to each other.

Originally posted by @DeepakM02 in https://github.com/NewOldMax/react-form-validator-core/issues/50#issuecomment-505376196

NewOldMax commented 5 years ago

Hi, you can just run form whole form validation like here If you don't need whole form validation, you can set ref for needed input and call validate manually


  handleFirstInputChange(e) {
    const { name, value } = e.target;
    this.setState(
      {
        [name]: value
      },
      () => this.secondInputRef.validate(this.secondInputRef.state.value)
    );
  }
DeepakM02 commented 5 years ago

Hey @NewOldMax, Can I use validatorListener for both min and max input field in this example and pass props minNumber and maxNumber into validators?

NewOldMax commented 5 years ago

You can try, why not