-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix input validation with email and binary choice fields
- Loading branch information
1 parent
2d1127b
commit dd076f3
Showing
1 changed file
with
4 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -726,10 +726,6 @@ const VeteranServiceRequest: React.FC = () => { | |
placeholder="e.g. [email protected]" | ||
{...register("email", { | ||
required: "Email Address is required", | ||
pattern: { | ||
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, | ||
message: "Invalid Email Address", | ||
}, | ||
})} | ||
required | ||
error={!!errors.email} | ||
|
@@ -835,7 +831,8 @@ const VeteranServiceRequest: React.FC = () => { | |
name="serviceConnected" | ||
control={control} | ||
rules={{ | ||
validate: (value) => value !== null || "Service connected is required", | ||
validate: (value) => | ||
[true, false].includes(value) || "Service connected is required", | ||
}} | ||
render={({ field }) => ( | ||
<BinaryChoice | ||
|
@@ -893,7 +890,8 @@ const VeteranServiceRequest: React.FC = () => { | |
name="petCompanion" | ||
control={control} | ||
rules={{ | ||
validate: (value) => value !== null || "Service connected is required", | ||
validate: (value) => | ||
[true, false].includes(value) || "Companionship animal is required", | ||
}} | ||
render={({ field }) => ( | ||
<BinaryChoice | ||
|