tcomb-form-native
tcomb-form-native copied to clipboard
Remove validation errors
Version
Tell us which versions you are using:
- tcomb-form-native v0.6.7
- react-native v0.42.0
Expected behaviour
Switch errors stylesheet type back to normal on function call
Steps to reproduce
- Create form element
- Validate form
- Get errors on screen
- Change field's value
- Error text has gone, but field style is still 'error'
I am not sure this is a bug. Whether the validation errors disappear after the input changes or after the user press submit (triggering this.refs.form.getValue() again) is a UX decision IMHO.
@GrimStal you can always trigger this.refs.form.getValue() when your input changes, right?
I get the same error like this. @javiercr If you define a validation by using tcomb-form-native.refinement, the error will be gone after triggering this.refs.form.ge:tValue()
But if you have some custom validations (ex: confirmPassword), you need to change options property by setState:
this.setState({ options: FormValidation.update(this.state.options, { fields: { ConfirmPassword: { hasError: { $set: error }, error: { $set: error ? 'Passwords don't match' : '' }, }, }, }), form_values: form, });
If you update the options by setState method, the errors will not be gone after triggering this.refs.form.getValue() again.
@javiercr By adding this.refs.form.getValue() to onchange form updates nicely .But when each form element become valid keyboard closes automatically .How can we fix it?