From 7de2cf9d1ddf959bb2f0251cf4dc96ef2c201299 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Tue, 2 Jul 2024 13:46:45 +0200 Subject: [PATCH] Improve component Type of service UX - JS validation was added. This improves the rules regarding selecting the number of required TOS entries - The addition of the ;decorated; class on the choice attributes improved styling - html5 validation was added, the group is now `required` --- .../DashboardBundle/Form/Entity/OidcngEntityType.php | 7 ++++++- .../DashboardBundle/Form/Entity/SamlEntityType.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Entity/OidcngEntityType.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Entity/OidcngEntityType.php index b88fcc549..6efdcfa0a 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Entity/OidcngEntityType.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Entity/OidcngEntityType.php @@ -249,10 +249,15 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'typeOfService', ChoiceType::class, [ - 'required' => false, + 'required' => true, 'choices' => $this->typeOfServiceProvider->getTypesOfServiceChoices(), 'choice_value' => fn(TypeOfService $tos): string => $tos->typeEn, 'choice_label' => fn(TypeOfService $tos): string => $tos->typeEn, + 'choice_attr' => fn(): array => [ + 'class' => 'decorated', + 'data-parsley-mincheck' => 1, + 'data-parsley-maxcheck' => 3, + ], 'expanded' => true, 'multiple' => true, 'attr' => [ diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Entity/SamlEntityType.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Entity/SamlEntityType.php index aa6425fad..4c31d436b 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Entity/SamlEntityType.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Entity/SamlEntityType.php @@ -241,10 +241,15 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'typeOfService', ChoiceType::class, [ - 'required' => false, + 'required' => true, 'choices' => $this->typeOfServiceProvider->getTypesOfServiceChoices(), 'choice_value' => fn(TypeOfService $tos): string => $tos->typeEn, 'choice_label' => fn(TypeOfService $tos): string => $tos->typeEn, + 'choice_attr' => fn(): array => [ + 'class' => 'decorated', + 'data-parsley-mincheck' => 1, + 'data-parsley-maxcheck' => 3, + ], 'expanded' => true, 'multiple' => true, 'attr' => [