I’m looking for something to make this kind of input in Symfony:
I don’t know which kind of input and how to deal with the Symfony controller.
$form = $this->createFormBuilder($newLot) ->add('lotType',null,['required' => false]) ->add('lotGenre',null,['required' => false]) ->add('ville',null) ->add('quartier',null) ->add('prix',null,['required' => false]) ->add('prix', null,['required' => false]) ->add('superficie', RangeType::class,['required' => false]) ->add('createdAt', RangeType::class,['required' => false]) ->add('gestionnaire',null) ->add('lotStatut',null) ->getForm();
Here is a part of my controller but not sure it’s useful.
Advertisement
Answer
If you want to represent a start date linked to an end date, I’d advise you to create two DateType fields, like this:
->add('startDate', DateType::class, [some_parameters]) ->add('endDate', DateType::class, [some_parameters])
Then, you design your two fields in your template, by adding the “à” cell between them.
The RangeType is not appropriate to render dates, it renders this kind of input.