Hi everybody.
Thanks for reading this stuff.
I am using dosamigos DateTimePicker component in my app and almost all things are fine. The only issue that I can not figure out is how to enable/make client validation for this type of fiedl.
[b]
The widget code:[/b]
echo DateTimePicker::widget([
'model' => $model,
'attribute' => 'date',
'size' => 'ms',
'clientOptions' => [
'autoclose' => true,
'startView' => 3,
'minView' => 3,
'maxView' => 4,
'format' => 'yyyy-mm-dd'
],
]);
The Model Code - rules() function
public function rules()
{
return [
[['id', 'date'], 'required'],
[['date'], 'date', 'format' => 'yyyy-mm-dd']
];
}
The logic works fine, so the model is not submitted due to false validation, but I really want to show user standard ‘has-error’ class when he forgets to pick the date from the field.
Please do not hesistate any questions or ask for other snippets.
Many thanks in advance!