Skip to content
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

Fix validation for edit meal request modal #163

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading