Skip to content

Commit

Permalink
added example for switch checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Jan 7, 2022
1 parent 8c1c464 commit d0e203c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Form/FormDemoModelType.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'constraints' => new Length(['min' => 3]),
])
->add('job', ChoiceType::class, [
'choices' => ['Pilot' => 'p', 'Doctor' => 'doc', 'Manager' => 'm', 'Developer' => 'd', 'Other' => 'o'],
'constraints' => new EqualTo(['value' => 'd', 'message' => 'Nope! The best job in the world is Developer ... at least for me ;-)']),
'choices' => ['Pilot' => 'p', 'Nurse' => 'n', 'Manager' => 'm', 'Developer' => 'd', 'Other' => 'o'],
'constraints' => new EqualTo(['value' => 'd', 'message' => 'Nope! The best job in the world is software developer ;-)']),
'help' => 'Choose the best job in the world',
])
->add('bootstrapSelect', ChoiceType::class, [
Expand Down Expand Up @@ -99,7 +99,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
])
->add('termsAccepted', CheckboxType::class, [
'required' => false,
'label' => false,
])
->add('checkboxSwitch', CheckboxType::class, [
'required' => false,
'label_attr' => ['class' => 'checkbox-switch']
])
->add('termsAccepted', CheckboxType::class, [
'required' => false,
Expand Down Expand Up @@ -145,7 +148,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'required' => false,
])
->add('price', MoneyType::class, [
'label' => false,
'required' => false,
])
->add('password', PasswordType::class, [
Expand Down

0 comments on commit d0e203c

Please sign in to comment.