Skip to content

Conversation

@zweatshirt
Copy link
Contributor

@zweatshirt zweatshirt commented Jul 15, 2025

Description

Jira ticket

  • Standardizes the AddDonation form, since many of the errors across fields were inconsistent.
  • For consistency, I tried to make my changes relatively similar to the changes made in MPDX-8679

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels. (Add the label "On Staging" to get the branch automatically merged into staging.)
  • I have requested a review from another person on the project

@zweatshirt zweatshirt added the Preview Environment Add this label to create an Amplify Preview label Jul 15, 2025
@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

github-actions bot commented Jul 15, 2025

Bundle sizes [mpdx-react]

Compared against f62263d

No significant changes found

@zweatshirt zweatshirt requested a review from wjames111 July 15, 2025 14:54
Copy link
Contributor

@wjames111 wjames111 left a comment

Choose a reason for hiding this comment

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

Looks great! thanks for improving this form. The only issue I had was getting the DateField working.

@wjames111
Copy link
Contributor

wjames111 commented Jul 15, 2025

So right now we are essentially hacking the touched state by either leaving out the check for touched or forcing it to trigger on load onBlur={handleBlur('fieldValue')}. instead we could ensure Formik is properly updating the touched value by using formik's setFieldTouched.

 onChange={(_, value) => {
   setFieldValue('fieldValue', value);
   setFieldTouched('fieldValue', true, false);
}}
onBlur={() => {
  setFieldTouched('fieldValue', true);
}}

I think this is the best way to handle the form validation, it also works on the CustomDateField. CC @kegrimes

@zweatshirt
Copy link
Contributor Author

So right now we are essentially hacking the touched state by either leaving out the check for touched or forcing it to trigger on load onBlur={handleBlur('fieldValue')}. instead we could ensure Formik is properly updating the touched value by using formik's setFieldTouched.

 onChange={(_, value) => {
   setFieldValue('fieldValue', value);
   setFieldTouched('fieldValue', true, false);
}}
onBlur={() => {
  setFieldTouched('fieldValue', true);
}}

I think this is the best way to handle the form validation, it also works on the CustomDateField. CC @kegrimes

@wjames111 Is this a change that should be made on all form fields or just the DateField one?

@wjames111
Copy link
Contributor

@zweatshirt Ideally all of them if possible.

@zweatshirt zweatshirt requested a review from wjames111 July 16, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Preview Environment Add this label to create an Amplify Preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants