Jui date picker not showing up

Hi,everyone.Trying to use jui Datepicker,but nothing appearing on the form.I installed the extension via composer,fx asset plugin is listed under installed packages,along with jui, Added yii\jui\Datepicker in view file.Wondering what it could be? Need advice Thanks.

Follow the official documentation : https://www.yiiframework.com/extension/yiisoft/yii2-jui/doc/api/2.1/yii-jui-datepicker

Thanks already did.This is my view file

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\jui\DatePicker;

/* @var $this yii\web\View /
/
@var $model app\models\Status /
/
@var $form yii\widgets\ActiveForm */
?>

<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, 'message')->textInput(['maxlength' => true]) ?>

<?= $form->field($model, 'permission')->textInput() ?>

<?= $form->field($model,'created_at')->widget(\yii\jui\DatePicker::className(), [
        'language' => 'en',
        'dateFormat' => 'yyyy-MM-dd',
        'inline' => true
 ]) ?>   
    
    <div class="form-group">
    <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>

<?php ActiveForm::end(); ?>

Here is a simple example.

Model

<?php

namespace app\models;

use Yii;
use yii\behaviors\TimestampBehavior;
use app\models\query\ItemQuery;

/**
 *
 * @property int $id
 * @property string $name
 * @property double $price
 * @property int $date_of_transaction
 * @property int $created_at
 * @property int $updated_at
 *
 * Class Item
 * @package app\models
 */
class Item extends \yii\db\ActiveRecord
{
    /**
     * @return string
     */
    public static function tableName()
    {
        return 'item';
    }

    /**
     * @return array
     */
    public function rules()
    {
        return [
            [['name', 'price'], 'required'],
            [['price'], 'number'],
            [['date_of_transaction'], 'default', 'value' => null],
            [['name'], 'string', 'max' => 55],
        ];
    }


    /**
     * @return array
     */
    public function behaviors()
    {
        return [
            TimestampBehavior::class,
        ];
    }

    /**
     * @return array
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'name' => Yii::t('app', 'Name'),
            'price' => Yii::t('app', 'Price'),
            'date_of_transaction' => Yii::t('app', 'Date of transaction'),
            'created_at' => Yii::t('app', 'Created at'),
            'updated_at' => Yii::t('app', 'Updated at'),
        ];
    }

    /**
     * @return \app\models\query\ItemQuery
     */
    public static function find()
    {
        return new ItemQuery(get_called_class());
    }
}

View

<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\jui\DatePicker;

/* @var $this yii\web\View */
/* @var $model app\models\Item */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="item-form">
    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'price')->textInput() ?>

    <?= $form->field($model, 'date_of_transaction')->widget(DatePicker::class, [
        'dateFormat' => 'dd-MM-yyyy',
    ]) ?>

    <div class="form-group">
        <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>
</div>

Thank you,It was a cache issue.

1 Like

Youā€™re welcome.