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

Feature: Add "contextProps.validated" #151

Closed
kettanaito opened this issue Jan 24, 2018 · 3 comments
Closed

Feature: Add "contextProps.validated" #151

kettanaito opened this issue Jan 24, 2018 · 3 comments
Assignees
Labels
feature Adds new functionality. needs:clarification scope:validation Changes affect validation.
Projects
Milestone

Comments

@kettanaito
Copy link
Owner

What

I suggest we add validated property of the field stating that the field has been validated.

Why

Now we have separate validatedSync and validatedAsync. They are great for granular logic, but in cases you need just to react in UI if the field has been validated, regardless of the validation type, the property is missing.

How

  1. Tight together validatedSync and validatedAsync at the certain point of validation, and assign into a dedicated prop.
@kettanaito kettanaito added enhancement Enhances existing functionality. needs:clarification labels Jan 24, 2018
@kettanaito kettanaito added this to the Release 2.0 milestone Jan 24, 2018
@kettanaito kettanaito added the feature Adds new functionality. label Jan 26, 2018
@kettanaito
Copy link
Owner Author

validated is, probably, most reliable to compose within Form.validateField() method.

It needs to be reset to false when the validation begins, and back to true when it ends. The only place controlling this behavior is the mentioned Form's method. Other helper utils are rather pure functions, and bringing the beginning/end context to them would be redundant.

@kettanaito kettanaito added the scope:validation Changes affect validation. label Jan 30, 2018
@kettanaito kettanaito removed the enhancement Enhances existing functionality. label Feb 14, 2018
@kettanaito kettanaito modified the milestones: 2.0, 1.x.x Apr 17, 2018
@kettanaito kettanaito self-assigned this Apr 18, 2018
@kettanaito kettanaito added this to In progress in Roadmap Apr 18, 2018
@kettanaito
Copy link
Owner Author

kettanaito commented Apr 18, 2018

Just as mentioned, validated is set during the Form.validateField() method, depending on the respective prop from the validation function's propsPatch Map. Each field onChange event resets the validated prop, as well as other similar props, to false.

At the moment fields with no validation needed will always have validated set to false, and I find this a proper behavior, since no validation was intended to happen at the first place.

@kettanaito
Copy link
Owner Author

Merged. Closing.

Roadmap automation moved this from In progress to Released Apr 18, 2018
@kettanaito kettanaito moved this from Released to Staging in Roadmap Apr 18, 2018
@kettanaito kettanaito moved this from Staging to Released in Roadmap Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds new functionality. needs:clarification scope:validation Changes affect validation.
Projects
Roadmap
  
Released
Development

No branches or pull requests

1 participant