Home Yii2 Redirect to previous page after update
Reply: 0

Yii2 Redirect to previous page after update

user843 Published in July 21, 2018, 1:47 pm

I have a application where after update user should be redirected to previous page from pagination. let's say there is a gridview and user is at page 3. Then he update some record at that page. There should be a redirect to index page 3. What if, while user is updating record, before save, he opens another controller/action in new tab. Then ReturnUrl is now that new action and after save the record he is updating, he is redirected to that new url.

I've tried to set in every action "index" Url::remember(); and then in action "update" - return $this->goBack().

Also return $this->redirect(Yii::$app->request->referrer);, but it stays at same page.

There is a way to store every index URL in session, but in large project that means many sessions.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.315664 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO