Closed Endless8 closed 7 months ago
The changes involve updating the form validation and error display logic in a signup form. Instead of using toast messages to show validation errors, the errors are now directly associated with each form field and displayed beneath them. This approach enhances user experience by providing immediate, contextual feedback on input fields.
File Path | Change Summary |
---|---|
src/hooks/useFormLogic.js |
Removed toast messages for errors; directly set form errors in state. |
src/hooks/useValidation.js |
Added field property to error objects; updated error messages; added URL validation for website field. |
src/pages/Auth/AuthPage.css |
Added styles for error messages. |
src/pages/Auth/AuthSignup.jsx |
Added renderErrorMessage function to display errors below form fields. |
Objective | Addressed | Explanation |
---|---|---|
Validation error should come inside form only rather than in form Toast message (#1172) | ✅ | |
Make object for every field-state that can contain validation error as well (#1172) | ✅ | The changes include associating errors with specific fields, which aligns with the objective of having field-specific error objects. |
Show error just below of the fields (#1172) | ✅ | The renderErrorMessage function has been added to display errors directly below the corresponding form fields. |
This pull request has been deployed to Vercel.
Latest commit: | 856161a |
✅ Preview: | https://milan-75jf1lnld-iamtamal.vercel.app |
🔍 Inspect: | https://vercel.com/iamtamal/milan/4LcZGiFk86zosxqhsthJ25R1vJRm |
closes #1172
👷🏻 Changes made
I removed the toast notifications, assigned the validation errors to formState and output them below the corresponding field adding a field property to all the errors for filtering.
📸 Screenshots
Summary by CodeRabbit
Refactor
New Features
Style
Bug Fixes