I want to have some custom buttons on form create for example
Save and New,
Save & Go Back(which will redirect to Grid-view)
save and redirect to another form
I was able to add a button in the form like "add Parents" and redirect it to "parents create form".
I need a direction how can achieve the other actions.
My controller action create looks like this:
public function actionCreate()
{
$model = new Students();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->photo = Uploadedfile::getInstance($model,'photo');
//var_dump($model->photo);exit;
if($model->validate()){
$model->photo->saveas('uploads/' . $model->photo->basename . '.' . $model->photo->extension);
}
$model->photo->name;
$model->save();
return $this->redirect(['parents/create','id'=>$model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}