javascript + tabular input + CJuiDatePicker

Hello,

I’m using CJuiDatePicker in table’s cells where rows can be added using javascript. I’m following the code structure explained in this link: javascript + tabular input

In one cell, instead of using textField, I’m using CJuiDatePicker. In the view form/studentRow my code is:




<tr>

    <td>

        <?php

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

            'model' => $model,

            'attribute' => "[$id]desde",

            // additional javascript options for the date picker plugin

            'language' => 'es',

            'options' => array(

                'showAnim' => 'fold',

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

            ),

            'htmlOptions' => array(

                'style' => 'height:16px; width:70px;'

            ),

        ));

        ?>

        <?php echo $form->error($model, 'desde'); ?>

    </td>

    <td>

        <?php echo $form->textField($model, "[$id]fa", array('size' => 2, 'maxlength' => 4)); ?>

        <?php echo $form->error($model, 'fa'); ?>

    </td>

    <td>

        <?php echo $form->DropDownList($model, "[$id]formadia_id", CHtml::listData(CurvaDia::model()->findAll(), 'id', 'id')); ?>

	<?php echo $form->error($model,'formadia_id'); ?>

    </td>

    <td>

        <?php

        echo '<input type="button" value="-" onclick="deleteDato($(this), 365)" class="delete" title="Eliminar punto de curva" id="botonMasMenos" />';

        ?>

    </td>

</tr>



When de page is rendered with the data fetched from de database, the date picker in those cells work ok. But after adding a new row, date picker doesn’t work.

Can anyone help me please?

i have the same issue on my time picker…

anyone help. my time picker in my form




  <td>    

            <?php echo $form->labelEx($model,"[$id]time"); ?>

            <?php $this->widget('application.extensions.jui_timepicker.JTimePicker', array(

             'model'=>$model,

             'attribute'=>"[$id]time",

             'options'=>array(

                 'showPeriod'=>false,

                 'hours'=>array('starts'=>07, 'ends'=>18),

                 ),

             'htmlOptions'=>array('size'=>5,'maxlength'=>5),

            ));?>

           

    </td>



anyone…

anyone?

Each time you clone a row you need to reinitialize the widget on that row.

Search for jqrelcopy for inspiration.

You can try the multimodelformextension.

JS-code for handling the reinitializing after clone is included.

See chapter ‘Usage widget form elements’.

After adding new row for add call this below function And All new dates must have same class (.date)


Yii::app()->clientScript->registerScript('re-install-date-picker', "

function reinstallDatePicker(id, data) {


    $('.date').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['ja'],{'dateFormat':'yy-mm-dd'}));

}

");

SOLVE thank you for your extension…