Its Simple way to enable the Datepicker when Click the text field in PHP Yii Frameworks.
Step 1 - Install the Datepicker widget to the yii-2 with the help of procedures in the following link.
https://github.com/2amigos/yii2-date-picker-widget
Step 2 - Remove the Textfield code from the form.php
<?= $form->field($model, 'date')->textInput(['maxlength' => true]) ?>
Step 3 - Replace the textfield code by the follwing
Step 1 - Install the Datepicker widget to the yii-2 with the help of procedures in the following link.
https://github.com/2amigos/yii2-date-picker-widget
Step 2 - Remove the Textfield code from the form.php
<?= $form->field($model, 'date')->widget ( DatePicker::className(), [ // inline too, not bad 'inline' => false, // modify template for custom rendering 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd-M-yyyy'] ] ); ?>
Step 4 - Have to access the Datepicker at the beginning , just copy the following and paste it.
use dosamigos\datepicker\DatePicker ;
Output -
Before Clicking the text field
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-if2xl4wTfvgqeIdKmttTvv9Q2f3oucEjT64OqZlpY5ye0AGRifnOp7gNvNgZj-ieFYZWMihC2iL8OC1lcLScLg6OS98QaPm4eEAWWtGW2xBqRziXSTyY69oLSf1PAs0SiA6zJFuCI9ld/s400/Screen+Shot+2016-08-26+at+11.16.13+AM.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVRkCJEPxt4FGuzQqAQu-xxcNXWb1ECe-7jw12EIGydjSDMFpiec7OPJRoFUOULs8WoTv8xo9hMuSN_juFhRh2wDBbvnJV8OfZMDXRhB1HGFdUIzFQMOa2trWKSr-St97YGPZzRevZ_nvl/s400/Screen+Shot+2016-08-26+at+11.20.30+AM.png)
No comments:
Post a Comment