重定向后保持 Zend Form 对象 [英] Persist Zend Form object after redirect

查看:31
本文介绍了重定向后保持 Zend Form 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以问题是我在页面 A 中有一个表单,它正在页面 B 提交.在页面 B 验证表单后,它应该重定向回页面 A 并显示可能发生的错误的表单.

So the thing is I have a form in page A which is being submitted at page B. After validating the form at page B, it should redirect back to page A and show the form with the possible errors that occurred.

实现这一目标的最佳方法是什么?将整个表单对象临时放在会话中是否明智?或者有更优雅的解决方案吗?

What's the best way to achieve this? Is it smart to temporary put the whole form object in the session? Or is there a more elegant solution?

推荐答案

为什么不在页面 A 验证它,如果它有效,然后转发到页面 B?这样你就不必做任何丑陋的黑客攻击.

Why not validate it on page A, and then forward to page B if it's valid? That way you don't have to do any ugly hacks.

这篇关于重定向后保持 Zend Form 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆