-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model attribute has error, but DatePicker doesnt display it #83
Comments
I've encountered the same problem with DatePicker widget and Bootstrap4. |
So is it related to |
@buttflattery Its related to compatibilitiy between yii2-bootstrap4 and jui/datepicker. I am talking about server-side validation errors, but client-validation errors also may be affected, I didn't tested it yet |
if yii\jui\Widget extends from \yii\widgets\InputWidget, at least with datepicker and autocomplete it works |
As a temporary workaround, until this bug can be fixed, a manual setting of the <?= $form->field($model, 'date_from')->widget(DatePicker::classname(), [
...
'options' => [
...
'class' => 'form-control' . ($model->hasErrors('date_from') ? ' is-invalid' : '')
...
],
...
]) ?> |
<?= $form->field($model, 'dob')->widget(DatePicker::class, [
'options' => ['placeholder' => 'Enter birth date'],
'pluginOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd',
]
])->error(['class' => 'invalid-feedback d-block']); ?> Try appending the ->error(['class' => 'invalid-feedback d-block']); at the end of the line. |
Hi. I created a library to solve these sort of problems. |
What steps will reproduce the problem?
What's expected?
Input with datepicker and error text
What do you get instead?
Input with datepicker with no error
How to fix it?
The text was updated successfully, but these errors were encountered: