我发现当我尝试
时$this->addElement('hidden', 'id');
跑步,我得到类似
的东西Fatal error: Call to a member function getOrder() on a non-object in D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Form.php on line 3318
Call Stack:
0.0002 329712 1. {main}() D:\Projects\Tickle\public\index.php:0
0.0726 1393760 2. Zend_Application->run() D:\Projects\Tickle\public\index.php:26
0.0726 1393760 3. Zend_Application_Bootstrap_Bootstrap->run() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Application.php:366
0.0727 1393816 4. Zend_Controller_Front->dispatch() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Application\Bootstrap\Bootstrap.php:97
0.1787 2026520 5. Zend_Controller_Dispatcher_Standard->dispatch() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Front.php:954
0.1860 2144464 6. Zend_Controller_Action->dispatch() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:295
0.2089 2771352 7. Zend_Controller_Action_HelperBroker->notifyPostDispatch() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Action.php:523
0.2090 2772208 8. Zend_Controller_Action_Helper_ViewRenderer->postDispatch() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Action\HelperBroker.php:277
0.2091 2772208 9. Zend_Controller_Action_Helper_ViewRenderer->render() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Action\Helper\ViewRenderer.php:957
0.2099 2772400 10. Zend_Controller_Action_Helper_ViewRenderer->renderScript() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Action\Helper\ViewRenderer.php:918
0.2099 2772400 11. Zend_View_Abstract->render() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Action\Helper\ViewRenderer.php:897
0.2100 2813576 12. Zend_View->_run() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\View\Abstract.php:880
0.2103 2814016 13. include('D:\Projects\Tickle\application\views\scripts\projects\edit.phtml') D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\View.php:108
0.2103 2814016 14. Zend_Form->__toString() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Form.php:0
0.2103 2814016 15. Zend_Form->render() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Form.php:2916
0.2117 2825200 16. Zend_Form_Decorator_FormElements->render() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Form.php:2900
0.2120 2827128 17. Zend_Form->rewind() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Form.php:0
0.2120 2827128 18. Zend_Form->_sort() D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Form.php:3225
当我尝试
时$this->addElement('hidden', 'id2');
它有效
我的Zend_Form http://pastie.org/1425012供参考
答案 0 :(得分:2)
终于被指责=)
将您的媒体资源名称$id
更改为$_id
(以及参考资料$this->_id
)。 Zend表单在定义元素时使用属性名称。因此,请始终使用下划线或其他内容来区分名称。
protected $_minimalMode;
protected $_id;