Answer the question
In order to leave comments, you need to log in
How to reset data in modal window?
Greetings! Made sending letters from a modal window according to this lesson. But when submitting, the data in the form remains and when the page is reloaded, they try to leave again. In the widget, I added a line that is commented out, but it gives an error that there is no such method
<?php
namespace frontend\components;
use Yii;
use yii\base\Widget;
use frontend\models\ContactForm;
class FBFWidget extends Widget
{
public function run()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('contactFormSubmitted');
//return $this->refresh();
}
return $this->render('fbfWidget', [
'model' => $model,
]);
}
}
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