zend框架:在表单类中设置操作
我有一个 Zend Framework 应用程序,并且我一直在表单类中设置表单操作。
class Form_Nieuws_AddForm extends Zend_Form {
public function init() {
$this->setMethod('get');
$this->setAction('/test/blaat');
$this->setAttribs(array(
'id' => 'frmCreate',
'class' => 'baal'
));
....
}
}
属性设置好了,但是动作和方法不行? 如果我将它们移至控制器,它就可以正常工作。怎么会?
I have a Zend Framework application and I am stuck with setting the form action in the form class.
class Form_Nieuws_AddForm extends Zend_Form {
public function init() {
$this->setMethod('get');
$this->setAction('/test/blaat');
$this->setAttribs(array(
'id' => 'frmCreate',
'class' => 'baal'
));
....
}
}
The attribs are set just fine, but the action and method not?
If I move these to the controller it works just fine. How come?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我在你那里,我会使用 Zend_Form 常量在表单 init 方法中设置方法,如下所示:
并使用正确的方法来构造 url 的控制器中的操作:
If I where you, I would set the method in the form init method using the Zend_Form costants like this:
and the action in the controller using the proper method to costruct the urls: