Binding Kartik datepicker with textInput


I’m new in Yii2. please help me how to binding Kartik datepicker with textInput. if i choose date then textinput get the date value??


Hi sugengr!

Not sure if I understood. I usually use to code datepicker like a widget inside a formfield. See:


        use kartik\form\ActiveForm;

        use kartik\form\ActiveField;

        use kartik\date\DatePicker;

        // ....

        echo $form->field($model, 'rev_date')->widget(DatePicker::classname(), [

            'class' => 'col-sm-3',

            'language' => 'pt-BR',

            'size' => 'sm',

            'type' => 2,

            // 'disabled' => true,

            'options' => [

                'placeholder' => 'Selecione uma data ...',

                'style' => 'width: 130px'],

            'pluginOptions' => [


                'format' => 'dd/mm/yyyy',

                'todayHighlight' => true,


    ]) ?>

Hope it helps.