News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthew Weier O'Phinney's Blog:
Creating composite elements
April 14, 2009 @ 10:25:53

Based on an example in a previous blog post (seen here) Matthew Weier O'Phinney wanted to clear a few things up on the "date of birth" element he had mocked up in his Zend_Form example.

In my last post on decorators, I had an example that showed rendering a "date of birth" element [...]. This has prompted some questions about how this element might be represented as a Zend_Form_Element, as well as how a decorator might be written to encapsulate this logic. Fortunately, I'd already planned to tackle those very subjects for this post!

To be able to use the element in its current state the key lies in the setValue method. More correctly in the overriding of the setValue method. He includes an example class that is smart enough to use that custom form element. It has get and set methods for each of the date fields (month/day/year) and the set/getValue methods that can interact using them. He wraps this all up inside a form decorator and creates an instance of the Date element to help create and handle the properties it has.

0 comments voice your opinion now!
create composite element date zendform decorator custom


blog comments powered by Disqus

Similar Posts

Vinu Thomas' Blog: Quicker and cleaner Form using Zend Form

Ralph Schindler's Blog: Composite Rowsets For Many-To-Many Relationships Via Zend_Db_Table

Matthew Turland's Blog: Custom building php on windows and linux

Lee Davis' Blog: FormFactory - Driving Doctrine 1.2 / 2.x Mappings into Zend_Form objects

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 2)


Community Events





Don't see your event here?
Let us know!


interview opinion introduction language series refactor community code install testing threedevsandamaybe framework developer laravel unittest release list api podcast symfony2

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework