-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add form validations #105
Add form validations #105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, thank you so much for working on this, @gauravchl! :)
Forgive me if this isn't yet ready for review; there were two issues I noticed:
1/ When I start typing into the form, I see this error:
2/ On submit, I'm seeing this error: @lpatmo Are you getting this error after axios call? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good direction @gauravchl - I think we should also try to add specs here testing the expected validation behaviors.
Yeah, I was getting that error after submit! It looks like if you make this change, it works:
Not sure why, though -- makes me think tlds is broken in https://github.com/hapijs/joi/blob/master/API.md. UPDATE: Actually never mind, I'm confused because it's broken again, but after I restarted both my backend server and frontend app and I changed it back to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for your time on this, Gaurav! :D This is looking awesome! Will let @angelocordon review as well, and afterwards I think this should be ready to merge...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few comments, good job @gauravchl :)
); | ||
}; | ||
|
||
Field.propTypes = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are any of these required?
I think we can do a final pass and merge it in soon. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for a few clean up (see comments) and validation testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary:
This PR implements the form validation using React Hook form and JOI validation schema
First commit cf24584 implements the basic structure and reusable components required for validation.
Second commit 6f4ae37 is an example of how to apply validation to any form.
SignUpForm.schema.js
)Currently validation is only applied to signup form and server side error messages specific to individual field is not implemented yet.
Related Issue:
TODO: