1

I have a CForm builder code in my action:

    $form = new CForm(
        'application.components.portlets.views._newClientForm', 
        $model
    );

and array of input elements:

<?php
return array(
    'elements'=>array(
        'client_type'=>array(
            'type'=>'radiolist',
            'items'=>Client::getClientTypes()
        ),
        'mainPersonName1'=>array(
            'type'=>'text',
        ),

How can i render a CJuiDatePicker in my form ?

tereško
  • 58,060
  • 25
  • 98
  • 150
RusAlex
  • 8,245
  • 6
  • 36
  • 44

2 Answers2

3

In your view file:

<?php
    $this->widget('zii.widgets.jui.CJuiDatePicker',array(
                                                   'name'=>'arbitraryName',
                                                   'model'=>$model,
                                                   'attribute'=>'nameOfFormAttribute',
                                                   'options'=>array(
                                                              'jqueryOption'=>'jqueryOptionValue',
                                                              ),
                                                   ),
    );
 ?>

Obviously, you have to pass your $model object into the view for this to work.

::UPDATE:: Using only Cform you would do it this way: http://www.yiiframework.com/forum/index.php?/topic/7016-using-zii-cjuidatepicker-in-a-cform/

k to the z
  • 3,217
  • 2
  • 27
  • 41
0
'dob'=>array(
                       'type'=>'zii.widgets.jui.CJuiDatePicker',
                       'options'=>array(

                          'showAnim'=>'fold',
                          'dateFormat'=>'yy-mm-dd',
                      ),
            ),