在我的模型我用DateValidation如何爲DateValidation添加錯誤消息?
['date_birthday', 'date', 'format' => 'd.m.yy', 'min' => '01.01.1900', 'max' => date('d.m.yy'), 'tooSmall'=>'The date is from past. Try another','tooBig' => 'The date is from future. Try another', 'message' => 'Try to input the date'],
鑑於我所說的小部件
<?php echo $form->field($modelForm, 'date_birthday')->widget(\kartik\date\DatePicker::classname(), [
'type' => \kartik\date\DatePicker::TYPE_COMPONENT_APPEND,
'pickerButton' => false,
'options' => [
'placeholder' => '',
],
'pluginOptions' => [
'format' => 'dd.mm.yyyy',
'autoclose' => true,
'showMeridian' => true,
'startView' => 2,
'minView' => 2,
]
]) ?>
它檢查最小和最大日期,但沒有顯示錯誤消息。我認爲它是因爲模型和視圖中的日期格式不同。如何解決它?
你怎麼知道它檢查最小和最大日期? –
當我輸入日期超出範圍它不保存 – Jens