Answer the question
In order to leave comments, you need to log in
Yii2: Class 'ActiveForm' not found?
So the problem is this:
There is an action in siteController
public function actionProfile()
{
if (Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new ProfileForm();
$fields = $model->loadProfileData($language);
return $this->render('user-profile', array(
'fields'=>$fields,
'model'=>$model,
));
}
class ProfileController extends Controller {
public function actionSave()
{
if (Yii::$app->user->isGuest) {
return $this->goHome();
}
$request = Yii::$app->getRequest();
$model = new ProfileForm();
if ($request->isPost && $model->load($request->post())) {
$fields = $model->loadProfileData($language);
$message = "Your profile data has been saved";
return $this->render('user-profile', array(
'fields' => $fields,
'model' => $model,
'message' => $message
));
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question