Skip to content

Commit

Permalink
Fix input validation with email and binary choice fields
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminJohnson2204 committed Mar 19, 2024
1 parent 2d1127b commit dd076f3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions frontend/src/app/vsr/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dd076f3

Please sign in to comment.