Closed codepolariz closed 7 years ago
Could be that you hace changed its template
No, i didn't modify the template in any way this is my view code
<?= DatePicker::widget([
'model' => $model,
'attribute' => 'dob',
'template' => '{addon}{input}',
'clientOptions' => [
'format' => 'L',
'autoclose' => true,
'format' => 'yyyy-mm-dd',
'endDate'=> '1970-12-31',
]
]);?>
'template' => '{addon}{input}',
What if we use:
<?= $form->field($model, 'dob')->widget(
DatePicker::className(),
[
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd'
]
]
); ?>
Hey, have the same issue - any updates on this one?
@philippfrenze I need more info as I do use the widget and certainly the validation happens.
i had the same issue but when i gave it like this
<?= $form->field($model, 'dob')->widget(
DatePicker::className(),
[
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd'
]
]
); ?>
instead of
<?= DatePicker::widget([
'model' => $model,
'attribute' => 'dob',
'template' => '{addon}{input}',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd'
]
]);?>
it started to work.
use regx and preg_match($format, $date) after get time and check valid time ,u can define validator in model
@mahesheu already gave the solution and is as I suspected on the client side for the template.
The problem on the server could be that somehow the dob
is filled with values and thats why is not firing when validating. The solution provided by @faniuta could be the best and also including trim
filter on our rules too.
I used the datepicker to display date of birth with model rules and controller validate(), unfortunately validation does not work. VIEW
MODEL RULE
CONTROLLER