Skip to content

Commit

Permalink
feat: updates contact form val. (first/last name)
Browse files Browse the repository at this point in the history
- disallows entries beginning with special characters
  • Loading branch information
mohitb35 committed Nov 20, 2023
1 parent 754e107 commit 83413f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"contactDetails": "Contact Details",
"firstName": "First Name",
"firstNameRequired": "First Name is required",
"firstNameInvalid": "First name is invalid. Only these special characters are allowed: space ' . -",
"firstNameInvalid": "First name is invalid. It cannot start with a special character, and only these special characters are allowed: space ' . -",
"lastName": "Last Name",
"lastNameRequired": "Last Name is required",
"lastNameInvalid": "Last name is invalid. Only these special characters are allowed: space ' -",
"lastNameInvalid": "Last name is invalid. It cannot start with a special character, and only these special characters are allowed: space ' -",
"max50Chars": "Should be 50 characters or less",
"address": "Address",
"addressRequired": "Address is required",
Expand Down
4 changes: 2 additions & 2 deletions src/Donations/Components/ContactsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function ContactsForm(): ReactElement {
message: t("max50Chars"),
},
pattern: {
value: /^[\p{L}\p{N}\sß.'-]+$/u,
value: /^[\p{L}\p{N}ß][\p{L}\p{N}\sß.'-]*$/u,
message: t("firstNameInvalid"),
},
}}
Expand Down Expand Up @@ -266,7 +266,7 @@ function ContactsForm(): ReactElement {
message: t("max50Chars"),
},
pattern: {
value: /^[\p{L}\p{N}\sß'-]+$/u,
value: /^[\p{L}\p{N}ß][\p{L}\p{N}\sß'-]*$/u,
message: t("lastNameInvalid"),
},
}}
Expand Down

0 comments on commit 83413f1

Please sign in to comment.