开发者

Keep form errors after redirect?

开发者 https://www.devze.com 2023-01-19 18:12 出处:网络
I am implementing a multi-page form and I want the user to be redirected to the same page if there is a validation error on a form, rather than the model\'s edit/new page.To get around this, I updated

I am implementing a multi-page form and I want the user to be redirected to the same page if there is a validation error on a form, rather than the model's edit/new page. To get around this, I updated the controller action for the model so it redirects if the instance can not be saved. However, in doing so the error messages are lost - is there a way to redirect and inc开发者_如何学Clude the generated error messages?


Generally while dealing with error on forms, people use to render on save errors and redirect on save success. If you render, your errors and flash will be kept.

You just have to make sure that all instance variable needed in each of your pages are set in the controller doing the render.

0

精彩评论

暂无评论...
验证码 换一张
取 消