Use Yup Validation on Visit form
Closed this issue · 4 comments
sxgormley commented
Im going to leave the description of this a little open ended because I have not completely investigated this.
- lets keep the store submitting fns as they are, but only use them if everything validates
- try to create a yup validation schema. if not can you create a series of one line validation fns?
- in
VisitRouter/index.js
handleSubmitVisit
fn, pass values to avalidateVisitForm
fn, which you define in/validators/
. you can keep it all in the index file for now.
- handle submit visit returns an array. the items would be an object like
{ name: <name of field>, message: <error message> }
if the array is length 0, continue to submit. if, there are errors, bail out of the submit, save the error array to state (local state in the component?) then use errors accordingly.
this will allow use to use Material Ui's error messages or alerts by field.
sxgormley commented
Hey, @JackRyan1989! How's it coming?
JackRyan1989 commented
Hey @sxgormley I haven't yet started on this ticket. I'm hoping to get some closure during tonight's meeting about the update django admin ticket so I can close that one and then devote my attention fully to this ticket.
sxgormley commented
Hey @MikeyManoguerra and @JackRyan1989! How's this coming along?
JackRyan1989 commented
@sxgormley Pretty good! I have the validation code in place and ready to roll, I just need to implement some error handling that uses the Snackbar component that is currently being built. Once that is finalized I'll implement it and this will be ready for review.