Posts Tagged ‘forms’

Simplifying the drawing of forms in Symfony

Friday, February 18th, 2011
No Gravatar

Implementing forms in 2011 is still a challenge, even with a framework like Symfony helping you along. sfForm is great for defining widgets and validators but it sucks at outputting practical markup.

Practical Markup

For me, the ideal markup for a form field looks like:

This gives me a lot of flexiblity for styling. Unfortunately I was never able to find a way to acheive this using formatters, and so I continued on writing very verbose forms. Luckily I grew weary of this and decided to see if I could create a helper to ease the output of forms. The following is what I cam up with: