2016-06-22 11:50
浏览 106

在Symfony 2 twig上获取默认日期时间表单

i have some probleme, i would like to have a default value in my datetime twig, i dont want to have the defaut value from BuildForm cause i use it for other twigs.

My add twig

     <div class="form-group">
        {{ form_label(form.Url, "Le URL", {'label_attr': {'class': 'col-sm-4 textTab control-label'}}) }}
        {{ form_errors(form.Url) }}
        <div class="col-sm-6">
          {{ form_widget(form.Url, {'attr': {'class': 'form-control'}}) }}

    <div class="form-group">
        {{ form_label(form.dateDeLaDemande, "Date de la demande du crawl", {'label_attr': {'class': 'col-sm-4 textTab control-label'}}) }}
        {{ form_errors(form.dateDeLaDemande) }}
        <div class="col-sm-6" style="margin-top: 8px;">
          {{ form_widget(form.dateDeLaDemande, {'attr': {'class': 'col-sm-6'}}) }}

    <div class="form-group">

        {{ form_label(form.DateDuCrawl, "Date du crawl", {'label_attr': {'class': 'col-sm-4 textTab control-label'}}) }}
        {{ form_errors(form.DateDuCrawl) }}
        <div class="col-sm-6" style="margin-top: 8px;">
          {{ form_widget(form.DateDuCrawl, {'attr': {'class': 'col-sm-6' }}) }}

And my buildFom

public function buildForm(FormBuilderInterface $builder, array $options)

              ->add('faitVP', 'checkbox', array('required' => false))
              ->add('integrerMavec','checkbox', array('required' => false))                    
//            ->add('historique','textarea')
              ->add('historiques', 'collection', array(
                        'type'         => new CategoryType(),
                        'allow_add'    => true,
                        'allow_delete' => true

Can some one help me plz ? thanks and sorry about my english :)

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题