我服用这些透过多个开发了一个网站。根据Zend_Version::VERSION
,该网站使用Zend版本1.12.0,这是一个新的框架。在该网站上,有一个名为App_Form_Customers_Edit
的表单类,它扩展了Zend_Form
。表单的操作是/ customers/edit,并在提交时执行CustomersController
的editAction方法。Zend_Form的提交 - >资源“控制器::行动”找不到
因此,创建一个新的形式,我在同一个目录中创建一个新的类App_Form_Customers_EditAddress
为App_Form_Customers_Edit
,并设置它的行动/customers/editaddress
,在CustomersController
类创建了一个名为editaddressAction
功能和测试形式。 但是我收到一个错误,提示“Resource'customers :: editaddress'not found”
表单本身显示正常,并且据我所知,我正在使用与其他表单一样的模式,除了不使用zf命令,Zend文档中规定的相同方法:http://framework.zend.com/manual/1.12/en/learning.quickstart.create-form.html
我需要做什么才能让我的新表单工作?我需要更新.zfproject.xml
吗?我看不到与工作形式有关的任何内容。
下面的代码为App_Form_Customers_Edit
:
class App_Form_Customers_Edit extends Zend_Form
{
public function init()
{
$this->addPrefixPath('App_Form', 'App/Form/');
$this->setMethod('post');
// ... The rest is just calls to $this->addElement
}
}
并为EditAddress
:
class App_Form_Customers_EditAddress extends Zend_Form
{
public function init()
{
$this->addPrefixPath('App_Form', 'App/Form/')
->setMethod('post')
->setAction('/customers/editaddress');
$this->addElement('submit', 'active', ['value' => 'Activate']);
$this->addElement('submit', 'remove', ['value' => 'Remove']);
$this->addElement('hidden', 'id');
}
}
是的!就是这样。花了我一段时间在数据库中找到他定义资源的位置。非常感谢! – turibe 2013-03-28 11:19:52