2012年8月1日星期三

TechPortal: Custom Zend Framework Form Elements


In this new post to the TechPortal, Gavin Corbett introduces you to Zend_Form elements (a part of the Zend Framework, v1) and how to create a custom one.



Creating forms in Zend Framework (ZF) is easy, but creating and managing complex forms can get messy! Using config files is perfectly good if you use standard Zend Form elements; it is quick and easy to setup a form in a few minutes however you will have limited control over how the form is rendered. If you want to display your own custom form element correctly in Zend Framework then some configuration is needed in order to achieve this with a config file.


He includes an example of first creating a basic form with a header and a single field element and validating the results of the submission. Building on that, he shows you how to create a custom "EmailAddress" form element and how to add in a view helper to style the output a bit.

没有评论:

发表评论