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

feat(core): use formts validation and submit handling #18

Merged
merged 6 commits into from
Oct 19, 2020

Conversation

mixvar
Copy link
Collaborator

@mixvar mixvar commented Oct 13, 2020

  • add errors, isValidating and isSubmitting to state
  • FieldHandle: implement get/set error, validate(), get isValid, and running validation on change and blur
  • FormHandle: implement get isSubmitting, get isValidating, get errors, get isValid, validate(), reset(), getSubmitHandler()

notes:

  • FieldHandle isValidating left for later

closes #5
touches #7

Mikołaj Klaman added 5 commits October 11, 2020 00:46
- store errors state as dictionary
- expose getter/setter for field errors
- expose list of all form errors
- expose computed isValid property for fields and form
call validator when:
- field value is set
- field is touched
- field validate method is called
- form validate method is called
@mixvar mixvar requested a review from pidkopajo October 13, 2020 00:00

dispatch({ type: "setIsValidating", payload: { isValidating: true } });
return options.validator
.validate(topLevelDescriptors, getField)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assumes validator runs validation recursively for nested fields when receiving root object or root array description. Looks like we don't have it implemented yet on the validator side - we can add this later after flattening the schema shape (should make it easier to implement)

@mixvar mixvar merged commit f501e71 into master Oct 19, 2020
@mixvar mixvar deleted the feat/use-formts-validation-handling branch October 19, 2020 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core] useFormts v2 - form handle
2 participants