-
Notifications
You must be signed in to change notification settings - Fork 5
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
Updates contact form validation to match to backend #446
Conversation
- hookform/devtools to debug the rhf forms - babel/plugin-transform-unicode-regex to enable unicode regexp
- updates contact form validation rules - updates error text - stores error messages in error.fieldname.message to reduce duplication - updates form-error styles to enable longer messages
- GiftForm.tsx - OnBehalf.tsx
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Ideally should not be possible, but I'm trying to match the validation to the backend. @jmiridis @mariahosfeld should we update this to prevent special characters at the start of the first name, last name, and company name? |
Even though it might be an edge case, I think for first name & last name we should prevent. |
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.
Tested functionality regarding communication as well as general behavior, everything works for me as expected.
- disallows entries beginning with special characters
Resolved in 83413f1 |
lgtm |
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.
Seems to work (commented possible clean ups)
@@ -53,6 +53,8 @@ | |||
"zod": "^3.22.4" | |||
}, | |||
"devDependencies": { | |||
"@babel/plugin-transform-unicode-regex": "^7.22.5", | |||
"@hookform/devtools": "^4.3.1", |
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.
Is this still necessary after you commented the import in the code below?
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.
not needed. but it makes it easier to debug react hook form when necessary.
@@ -19,6 +19,7 @@ import { AddressCandidate, GeocodeSuggestion } from "src/Common/Types/arcgis"; | |||
import GiftIcon from "public/assets/icons/GiftIcon"; | |||
import { euCountries } from "src/Utils/countryUtils"; | |||
import { isEmailValid } from "src/Utils/isEmailValid"; | |||
// import { DevTool } from "@hookform/devtools"; |
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.
Maybe just remove this line or do you want to keep it as some form of documentation on how to debug?
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
Resolves errors faced due to mismatch in server/client validation for the contact form fields
Changes:
a.
hookform/devtools
to debug rhf forms when neededb.
babel/plugin-transform-unicode-regex
- to allow unicode regexp patterns as used in server validation