Very cool. Thanks for the reply. This is kind of how I started to do it, I just wanted to make sure I wasn't recreating the wheel.
Looks great so far. -- Ian ----- Original Message ----- From: "Fabien POTENCIER" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, May 03, 2008 10:24 AM Subject: [symfony-devs] Re: Help with Widgets in 1.1 Hi Ian, The <?php echo $form ?> syntax is really for prototyping. As soon as you want greater/total control of the way the widgets are outputted, you need to display them individually (that's not totally true as you will see below...). And you can also render embed form this way with no problem. Let say you have a user form with an embed address form: $form outputs the whole form (user and address) $form['first_name'] outputs the first_name widget $form['first_name']->renderRow() outputs the first_name "row" $form['first_name']->renderLabel() outputs the first_name label $form['first_name']->renderError() outputs the first_name error messages if any $form['address'] outputs the whole embedded address form But, you can also access embedded widgets: $form['address']['city'] outputs the city widget $form['address']['city']->renderRow() outputs the city "row" To customize some HTML attributes: $form['address']['city']->render(array('class' => 'foo')) If you want to render the whole "row" (widget + label + error messages) in one call, use: $form['address']['city']->renderRow(array('class' => 'foo')) You can event customize the label and the help message: $form['address']['city']->renderRow(array('class' => 'foo'), 'Your City', 'Please enter your city...') So, the configuration of the view is done in the template, which makes sense. HTH, Fabien -- Fabien Potencier Sensio CEO - symfony lead developer sensiolabs.com | symfony-project.com | aide-de-camp.org Tél: +33 1 40 99 80 80 Slick Rick wrote: > I'm trying to take advantage of the new widget system, but I'm having a > hard time trying to figure out where the line between view and > controller is drawn. For instance, if I design a form in my controller, > how can I make it easy for my designers to apply CSS? If I have a table > with several rows, how can I apply a specific CSS class to 1 of those > rows? The only way I can see to do it is to render() each field > individually inside the template, which bypasses embedForm() > functionality. Is there a "best practices" way to implement a form and > display it in a template, so as not to make it too difficult for the > designer to style it? > > Thanks for the help! > > -- Ian > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---
