dongxi1320 2016-11-29 09:23
浏览 13
已采纳

范围symfony表单输入

i'm looking for something to make this kind of input in symfony [sample]

I don't know wich 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 usefull .

Thank's

  • 写回答

1条回答 默认 最新

  • 普通网友 2016-11-29 09:43
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?