我有以下错误
找不到类 'app\controllers\ActiveForm'
提交以下内容时ActiveForm
(kartik\widgets\ActiveForm)
$form = ActiveForm::begin([
'type'=>ActiveForm::TYPE_VERTICAL,
'action' => 'incarico/update/'.$model->id,
'enableAjaxValidation' => true,
'enableClientValidation' => false,
]);
我的控制器有这个动作:
public function actionUpdate($id)
{
$model = $this->findModel($id);
if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
错误指的是这一行
return ActiveForm::validate($model);