提交表单时出现此错误:
Bad Request (#400) Unable to verify your data submission.
我已经进入<?= Html::csrfMetaTags() ?>
布局。我认为,我有这个问题,因为我使用 datepicker。使用 ActiveForm 创建表单。
我必须做什么?这是表单的代码:
<?
$form2 = ActiveForm::begin(['id' => 'user-univer']);
echo $form2->field($model2, 'university')->label('Input university name:');
echo $form2->field($model2, 'degree')->label('Input your education specialization:');
//echo $form2->field($model2, 'date')->label('Input your education date:');
echo '<label class="control-label">Education time:</label><br/>';
echo '<span>Start date of your education:</span>';
echo DatePicker::widget([
'name' => 'date_from',
'value' => $value,
'dateFormat' => 'dd.MM.yyyy',
]);
echo '<span>End date of your education:</span>';
echo DatePicker::widget([
'name' => 'date_to',
'value' => $value,
'dateFormat' => 'dd.MM.yyyy',
]);
echo '<br/><br/>';
echo $form2->field($model2, 'info')->textarea()->label('Any other information about your university degree:');
echo Html::submitButton('Add university', ['class' => 'btn btn-primary btn-univer']);
ActiveForm::end(['id' => 'user-univer']);
} ?>
UPD:没有 datepicker 我也有同样的问题,为什么?如何解决?