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

Introduce "touched" concept #289

Closed
kettanaito opened this issue Sep 25, 2018 · 1 comment · Fixed by #338
Closed

Introduce "touched" concept #289

kettanaito opened this issue Sep 25, 2018 · 1 comment · Fixed by #338
Assignees
Labels
enhancement Enhances existing functionality. needs:testing
Milestone

Comments

@kettanaito
Copy link
Owner

kettanaito commented Sep 25, 2018

Environment

  • react-advanaced-form: 1.5.0

What

Current nature of validation will give an instant feedback upon any relative field input. Having a field marked in red isn't a supportive UX for a user trying to type in the value. I suggest to consider a more friendly flow.

Why

Granting more flexibility over when to display a validation feedback is a crucial part of effective fields layout. At the moment this possibility is somewhat limited to just invalid and errors properties.

How

I would prefer for the things to be configurable and dedicate this logic to the field component declaration. The end developer would be in charge of when to display error messages.

On the API level that would mean to establish something similar to "touched" fields.

Specification

  1. A field record has a new touched property.
  2. The default value of the touched property is false.
  3. By blurring out of a field, its touched property becomes true.
  4. Any further interactions with a field have no effect over the value of the touched property.
  5. Reseting the field resets the value of the touched property to its default value.
  6. Reseting the fields (on a form level) resets the value of the touched to its default value.
  7. Explicitly setting errors via formRef.setErrors() sets the value of the touched property of the affected fields to true.
@kettanaito kettanaito added the enhancement Enhances existing functionality. label Sep 25, 2018
@kettanaito kettanaito added this to the 1.x milestone Sep 25, 2018
@kettanaito kettanaito mentioned this issue Sep 27, 2018
Merged
3 tasks
@kettanaito kettanaito changed the title Instant validity feedback may be confusing Introduce "touched" concept Oct 1, 2018
@kettanaito kettanaito self-assigned this Oct 3, 2018
@kettanaito kettanaito added the good first issue Good for newcomers. label Oct 3, 2018
@kettanaito kettanaito mentioned this issue Oct 13, 2018
13 tasks
@kettanaito
Copy link
Owner Author

Implemented, ready to be released in 1.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances existing functionality. needs:testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant