How to use CJuiDatePicker in my _form ?

Hi I want to use the CJuiDatePicker widget in my _form.php,…but the problem is that it will add new textfield.how do I change the date_from of my form when I am going to click on it the datepicker will show.

Thank you in advance.




<?php


?>


<div class="form">


<?php $form=$this->beginWidget('CActiveForm', array(

	'id'=>'transaction-form',

	// Please note: When you enable ajax validation, make sure the corresponding

	// controller action is handling ajax validation correctly.

	// There is a call to performAjaxValidation() commented in generated controller code.

	// See class documentation of CActiveForm for details on this.

	'enableAjaxValidation'=>false,

)); 





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

    'name'=>'date_from',

    // additional javascript options for the date picker plugin

    'options'=>array(

        'showAnim'=>'fold',

    ),

    'htmlOptions'=>array(

        'style'=>'height:20px;'

    ),

));







?>


	<p class="note">Fields with <span class="required">*</span> are required.</p>


	<?php echo $form->errorSummary($model); ?>

 


    <div class="row">

        <?php echo $form->labelEx($model,'date_from'); ?>

        <?php echo $form->textField($model,'date_from'); ?>

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

    </div>


	etc......

	

<?php $this->endWidget(); ?>


</div><!-- form -->












check this :

http://www.yiiframework.com/doc/api/1.1/CJuiDatePicker

http://api.jqueryui.com/datepicker/

http://jqueryui.com/datepicker/

for detailed explanation

Hi Thank you for the reply…I am confuse… my form has only 5 textfield including date_from,but when I put the script of CJuiDatePicker like I posted above ,it will create a new textfield ,but what I want is to make my date_from textfield to have datepicker.I hope you understand what I mean.

Thank you in advance.

just take this line out


<?php echo $form->textField($model,'date_from'); ?>

and add the widget there that simple

@alirz23

Thank you it works :)