Forms in symfony
I am a begin开发者_StackOverflow中文版ner with symfony, and I can not get my head around forms generation. In theory there even is a form framework, to have complete flexibility. But, as far as I understand, forms are rendered as tables in symfony. I am used to CakePHP where I can output input elements one at a time, and then wrap them as I wish: in tables, divs, whatever, or, more often than not, nothing, and just use CSS to position them correctly.
I am a bit appalled at the fact that a framework with such high standards on code quality then outputs HTML tables where they are not needed. I guess I'm just missing something.
Is there a way to output forms as forms, without extra HTML tags?
A default formatter for sfForm::render()
is sfWidgetFormSchemaFormatterTable
. That's why your forms has been rendered as table when you used echo $form
.
- A Gentle Introduction to symfony: Chapter 10 - Forms
- Practical symfony - Day 10: The Forms
- The More with symfony book: Advanced Forms
sfForm::renderUsing()
sfWidgetFormSchema::setDefaultFormFormatterName()
- Tones of other resources all over the Internet
精彩评论