3

In a Symfony3 project, i have a SonataAdminBundle form like this :

  protected function configureFormFields(FormMapper $formMapper) {

        $formMapper->add('rentalTime', 'choice', array(
            'label' => 'Durée de location',
            'multiple' => false,
            'choices' => array(
                '3H' => '3',
                '24H' => '24',
            )
        ));
        $formMapper->add('rentalTimeType', 'choice', array(
            'label' => 'Type de durée de location',
            'multiple' => false,
            'choices' => array(
                'Heure(s)' => 'H',
                'Plage de jours' => 'R'
            )
        ));
    .
    .
    .

When i change the value of rentalTime i want to change the value of rentaltimeType. Example: If i select 24H in rentalTime field and automatically the rentalTimeType change for 'Plage de jours'.

I've read a lot of topic with the use of $subject but it's not exactly what i need.

So is it possible to do what i need ?

LedZelkin
  • 586
  • 1
  • 10
  • 24

1 Answers1

-2

You can customize the form specific to the data that was submitted by the user.

Dynamic Generation for Submitted Forms

Mohamed Ben HEnda
  • 2,686
  • 1
  • 30
  • 44