Collecting Tabular Input with zii jui widgets is broken?

I was looking at http://www.yiiframework.com/doc/guide/form.table for doing some batch updates. It appears to break with the zii jui widgets.


      <div class="row">

        <?php echo CHtml::activeLabelEx($item,'dateAssigned'); ?>

        <?php

              $this->widget('zii.widgets.jui.CJuiDatePicker', array(

                  'model'=>$item,

                  'attribute'=>'['.$i.']dateAssigned',

                  'options'=>array(

                      'showAnim'=>'fold',

                      'dateFormat'=>'yy-mm-dd',

                  ),

              ));

            ?>

        <?php echo CHtml::error($item,'dateAssigned'); ?>

      </div>

Error:


Property "item." is not defined.

I did some debugging in and it appears that it has to do with this code in CJuiDatePicker:


		if(isset($this->htmlOptions['name']))

			$name=$this->htmlOptions['name'];

		else

			$this->htmlOptions['name']=$name;


		if($this->hasModel())

			echo CHtml::activeTextField($this->model,$this->attribute,$this->htmlOptions);

if you comment out:


		//else

			//$this->htmlOptions['name']=$name;

everything works

bump? I am considering posting this to the bugs section.

I don’t know exactly this case, but in many examples tabular input is not working properly with widget or CHtml.

Usually I solve by calling a CHtml::resolveNameId() in some part of my widget. Maybe in CJuiDatePicker that one is missing.

I guess that is a bug, but before posting in bug section try to solve by editing the code of CJuiWidget, so you can present to staff bug + solution, and they will answer you sooner (maybe).

hi, Your fix works for me as well. Thanks