News Feed
Sections




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

Ian Christian's Blog:
Creating a custom form field type in Symfony 2
August 16, 2011 @ 12:04:37

Ian Christian has added a new post to his blog today showing how you can create a custom form field type in Symfony 2 by extending the AbstractType.

I am finally starting to dive into symfony 2 properly. Yes - it's taken a while, work has taken me in different directions! I found myself needing to create a custom form field type pretty quickly, but couldn't find much in the way of documentation to do so, so I thought I'ld throw it up here; partly to help others, but mostly to get feedback to make sure I'm not approaching this from the wrong angle.

He includes the code that creates his custom "Person" model and the class to create his "transport type" select box that pulls in its values from a "choice list" class. He registers it in his bundle and it can then be included in his buildForm() method just like any other form field.

0 comments voice your opinion now!
symfony tutorial custom form field select abstract


blog comments powered by Disqus

Similar Posts

The Bakery: Four New Articles - Load Balancing, Request Info, UUID Behavior & Upload Thumbnails

DZone.com: How to Use Flash for File Upload with PHP

DevShed: Tracking Website Statistics with PHP

SitePoint PHP Blog: How to Avoid 404s and Redirect Old URLs in PHP

DZone.com: Sencha Touch 2 Models - Loading And Saving Model Data Using a Proxy, PHP Example


Community Events





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


configure conference release threedevsandamaybe unittest introduction version symfony language interview composer list framework opinion voicesoftheelephpant api series podcast laravel community

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