2014-11-14 24 views
0

這是錯誤我得到:提供給逃生幫手ZF2主義editaction - 不允許遞歸

對象,但標誌不允許遞歸

<script type="text/javascript"> 

    $(document).ready(function(){ 

     $("#datadocarro").datepicker({ 
      changeMonth:true, 
      changeYear:true, 
      yearRange:"-100:+100", 
      dateFormat:"dd MM yy" 
      }); 



     $("#inspecao").datepicker({     
      changeMonth:true, 
      changeYear:true, 
      yearRange:"-100:+100", 
      dateFormat:"dd MM yy" 
      });  
}); 
</script> 

<dt><?php echo $this->formLabel($form->get('datadocarro')); ?></dt> 
<dd><?php 
    // the error is hapening here 
    echo $this->formElement($form->get('datadocarro')); 
    echo $this->formElementErrors($form->get('datadocarro')); 
?></dd> 

在附加動作,我有在視圖上相同的代碼,並在編輯動作視圖我得到的錯誤工作

現在的工作沒有錯誤 但JQ uery日期選擇器不工作

<dt><?php 
$ytestevq=$form->get('datadocarro'); 
$datecarroElement = new Zend\Form\Element\Date('datadocarro'); 
$datadocarrov=$form->get('datadocarro')->getValue()->format('Y-m-d'); 

    echo $this->formLabel($form->get('datadocarro')); ?></dt> 
<dd><?php 
    echo $this->formElement($datecarroElement->setValue($form->get('datadocarro')->getValue()->format('Y-m-d'))); 
    echo $this->formElementErrors($datecarroElement); 
?></dd> 

表單代碼

 $this->add(array(
     'name' => 'datadocarro', 

     'attributes' => array(
      'type' => 'Date', 

      'required' => 'required', 
      'class' => 'demoHeaders', 
      'id' => 'datadocarro', 
     ), 
     'options' => array(
      'label' => _('Car Date'), 
     ), 
    )); 

回答

0

您需要向我們展示了「datadocarro」元素的配置,也不管你是保溼的日期字符串成元素或作爲日期對象。

如果您將Date對象存儲到文本元素中,則表單在呈現時將引發此錯誤。 您可以將日期格式化爲字符串,或者如果您想使用HTML5元素,則使用Zf2的Date元素。