Codxplore.com

Latest news:

Sahih al-Bukhari (সহীহ বুখারী) is a free Hadith application for android. This application is advertisement free. Download now https://play.google.com/store/apps/details?id=com.akramhossin.bukharisharif

jQuery ui date picker in Yii


jQuery ui date picker in Yii

In this blog post we will learn how to add jQuery UI date picker to Yii application.

To display jQuery UI date picker in the view page we need to call Yii built-in function widget.

This widget function accepts following parameters

  • Widget Name
  • Widget Options

Widget options also accepts multiple parameters it depends on widget class like

  • Model object
  • Attribute Name
  • Options
  • htmlOptions
  • ........

In yii to display jQuery UI date picker we have to use zii.widgets.jui.CJuiDatePicker widget class, some of the options are

  • dateFormat
  • showAnim
  • changeMonth
  • changeYear
  • changeYear

We can use the below code for jQuery ui date picker in the view page

$this->widget('zii.widgets.jui.CJuiDatePicker', array(
          'model' => $model,
          'attribute' => 'PRD_START_DT',
          'options' => array(
             'dateFormat' => 'd-M-y',
             'showAnim' => 'slide',
             'changeMonth' => true,
             'changeYear' => true,
             'minDate' => date('d-M-y'),
          ),
         'htmlOptions' => array(
              'class' => 'form-control',
         ),
));

Tags : jQuery, PHP, Yii,

Views : 950

Subscribe Us


Follow Us