mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
Add validation for household metadata
A new validation group 'household_metadata' has been added to the Household form. The 'waitingForBirth' field now has a type check, and for the 'waitingForBirthDate' field, an expression is added to ensure it's set if 'waitingForBirth' is true. Simultaneously, error handling for form submission has been enriched in the HouseholdController to display specific error messages.
This commit is contained in:
@@ -220,6 +220,12 @@ class HouseholdController extends AbstractController
|
||||
'household_id' => $household->getId(),
|
||||
]);
|
||||
}
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
||||
foreach ($form->getErrors() as $error) {
|
||||
$this->addFlash('error', $error->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('@ChillPerson/Household/edit_member_metadata.html.twig', [
|
||||
'household' => $household,
|
||||
@@ -275,7 +281,7 @@ class HouseholdController extends AbstractController
|
||||
[
|
||||
'household' => $household,
|
||||
'positions' => $positions,
|
||||
'form' => null !== $form ? $form->createView() : null,
|
||||
'form' => $form?->createView(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user