You can do it pretty easily by changing:

<?php foreach ($form as $formField): ?>

to

<?php foreach ($form->getFormField() as $formField): ?>

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


Marijn wrote:
> Hi everybody,
> 
> I posted this two days ago in the symfony-user (http://
> groups.google.com/group/symfony-users/browse_thread/thread/
> a58af75b938d946a/e4184d11732ac823#e4184d11732ac823) list but I think I
> should have posted it here...
> 
> I have been playing around with the new form framework and since I
> moved past my initial thought (that it seemed to complicated for stuff
> that ought to be easy) I'm pretty much in love with it. I have a small
> request though: if you create a form where the fields should be
> decorated with all sorts of extensive markup it is nice to be able to
> simply loop over all the form fields like this:
> 
> [example]
> <?php foreach ($form as $formField): ?>
>   <div class='form_field'>
>     <div class='some_class_name'>
>       <?php echo $formField->renderLabel(), "\n"; ?>
>     </div>
> <?php if ($formField->hasError()): ?>
>     <div class='errors'>
>       <?php echo $formField->renderError(), "\n"; ?>
>     </div>
> <?php endif; ?>
>     <?php echo $formField->render(array('class' => 'pretty')), "\n"; ?
>   </div>
> <?php endforeach; ?>
> [/example]
> 
> This way you keep the template files small and applying changes is
> quite easy.
> 
> What are your thoughts on this?
> 
> Marijn
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to