Z
Z
ZaurK2017-05-21 23:16:44
Yii
ZaurK, 2017-05-21 23:16:44

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,
        ]);

    }
 
}

How to make it so that the data is reset?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-05-22
@webinar

$model->loadin a widget? Drop this lesson.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question