Skip to content

Commit

Permalink
Fix validation for edit meal request modal
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinToft committed Aug 23, 2024
1 parent b7657db commit a316bb6
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions frontend/src/pages/EditMealRequestForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,6 @@ const EditMealRequestForm = ({
}
}

if (!isEditDonation) {
if (deliveryInstructions === "") {
setAttemptedSubmit(true);
return false;
}
}

setAttemptedSubmit(false);
return true;
};
Expand Down Expand Up @@ -527,16 +520,17 @@ const EditMealRequestForm = ({
</Text>

{!isUpcoming ? (
<FormControl mt={3} mb={6} isRequired>
<FormControl
mt={3}
mb={6}
isRequired
isInvalid={attemptedSubmit && numberOfMeals <= 0}
>
<FormLabel
variant={{
base: "mobile-form-label-bold",
md: "form-label-bold",
}}

// TODO: Hook this up to a state variable
// TODO: Setup correct validation for this
// isInvalid={attemptedSubmit && }
>
Number of meals
</FormLabel>
Expand All @@ -552,7 +546,7 @@ const EditMealRequestForm = ({
) : null}

{!isUpcoming ? (
<FormControl mt={3} mb={6} isRequired>
<FormControl mt={3} mb={6}>
<FormLabel
variant={{
base: "mobile-form-label-bold",
Expand All @@ -569,14 +563,12 @@ const EditMealRequestForm = ({
</FormControl>
) : null}

<FormControl mt={3} mb={6} isRequired>
<FormControl mt={3} mb={6}>
<FormLabel
variant={{
base: "mobile-form-label-bold",
md: "form-label-bold",
}}
// TODO: Setup correct validation for this
// isInvalid={attemptedSubmit && }
>
Delivery Notes
</FormLabel>
Expand Down

0 comments on commit a316bb6

Please sign in to comment.