Skip to content

Commit

Permalink
Improve component Type of service UX
Browse files Browse the repository at this point in the history
- 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`
  • Loading branch information
MKodde committed Jul 3, 2024
1 parent 28ee05d commit 7de2cf9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down

0 comments on commit 7de2cf9

Please sign in to comment.