ZF-7791: Zend_Form doesn't handle PUT/DELETE requests.

Issue Type: Bug Created: 2009-09-07T06:41:15.000+0000 Last Updated: 2013-02-13T16:50:41.000+0000 Status: Closed Fix version(s): Reporter: Alex Zinchenko (admloki) Assignee: Luke Barton (lbarton) Tags: - Zend_Form

  • zf-crteam-review

Related issues: - ZF-2718



Good day.

Since 1.9 and Zend_Rest_Route/Zend_Rest_Controller PUT/DELETE methods was added in Zend_Form. But i founded Zend_Form doesn't handle them as expected. It just changes 'method' form param to PUT/DELETE, instead of creating a hidden '_method' field with necessary values.


Posted by Luke Barton (lbarton) on 2009-09-22T13:28:55.000+0000

I'm interested in opinions on this. Is this a problem we should be solving at all?

Rewriting the Form decorator doesn't really work since the Form decorator is on the end of the decorator stack; decorating with a form field (either in Zend_View_Helper_Form or the Form decorator itself) is a) repeating ourselves to output a form element and b) ignoring any other elements named _method, thus potentially rendering 2 html elements with the same name.

A more elegant solution may be to add an additional decorator to the begining of the default decorator stack; which adds the element and modifies the submission method, letting the existing decorators handle rendering the element in it's own right. This decorator could be removed via removeDecorator() to return handling of 'put' and 'delete' methods to the unhandled way. It would be possible to make this decorator configurable beyond defaults, so the user can alter the type and name of the element so it is not only compatible with the Zend_Rest_Route-style handling. I'd prefer explicitly adding this decorator however adding the decorator would require clearing the stack and re-adding the default decorators, since it's currently not possible to prepend a decorator to the stack. This would make adding the decorator more effort than adding manual handling.

Opinions welcome, I'll reconsider the course of action on Friday 25th of September.

Posted by Luke Barton (lbarton) on 2009-09-25T11:09:49.000+0000

I'll extend coments for another week.

Posted by Frank Br├╝ckner (frosch) on 2013-02-13T16:50:41.000+0000

A task for ZF2.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.