tcomb-form-native icon indicating copy to clipboard operation
tcomb-form-native copied to clipboard

Remove validation errors

Open GrimStal opened this issue 7 years ago • 3 comments

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

  1. Create form element
  2. Validate form
  3. Get errors on screen
  4. Change field's value
  5. Error text has gone, but field style is still 'error'

GrimStal avatar Mar 17 '17 09:03 GrimStal

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?

javiercr avatar Apr 08 '17 15:04 javiercr

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.

hodachop93 avatar Jul 04 '17 16:07 hodachop93

@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?

anoopmm avatar Feb 16 '18 05:02 anoopmm