Answer the question
In order to leave comments, you need to log in
Does url change when action is returned in Yii2?
Guys, we need a helper. There is a task: two-stage registration with verification and use of Active Form. Not the essence of what and how it works, it works separately. The problem is this: when I verify the data from the first page and write
if ($model->load(Yii::$app->request->post())) {
if ($model->validate()) {
return $this->actionSecond($model);
}
}
// ...
if ($model->load(Yii::$app->request->post())) {
if ($model->validate()) {
return $this->actionFinish();
}
}
return $this->render('view', [
'data' => $data,
])
// ...
Answer the question
In order to leave comments, you need to log in
1. To change the route, it is necessary to return not actionSecond, etc. And
$this->redirect("/my/controller/second")
2. Either change the route and add a check to the stage in the form, in the form of a hidden field, etc. And check this value in index and distribute it to the necessary actions
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question