Jukea, Thanks for the reply. I was just coming back to say I found a
way of doing it but I don't think it's as clean as I would like.

[CODE]
class RegistrationForm extends sfGuardUserForm
{
  public function configure() {
    parent::configure();

    $profile_form = new RegistrationProfileForm($this->getObject()-
>getProfile());
    $this->embedForm('profile', $profile_form);
    $this->getWidget('profile')->setLabel(false);
    $this->getWidget('profile')->setFormFormatterName
('listNoDecorator');
  }
}
[/CODE]

[CODE]
class sfWidgetFormSchemaFormatterListNoDecorator extends
sfWidgetFormSchemaFormatter
{
  protected
    $rowFormat       = "<li>\n  %error%%label%\n  %field%%help%\n
%hidden_fields%</li>\n",
    $errorRowFormat  = "<li>\n%errors%</li>\n",
    $helpFormat      = '<br />%help%',
    $decoratorFormat = "\n  %content%"; // Only change is  this line
removing the <ul></ul>
}
[/CODE]

[CODE]
// registrationSuccess.php
<?php echo form_tag_for($form, 'account/registration') ?>
  <ul>
    <?php foreach ($form->getFormFieldSchema() as $field ) : ?>
    <?php if ( get_class($field->getWidget()) == 'sfWidgetForm' ||
$field->getWidget() instanceOf sfWidgetFormInputHidden) : ?>
      <?php echo $field; ?>
    <?php else:  ?>
      <?php echo $field->renderRow() ?>
    <?php endif; ?>
    <?php endforeach; ?>
    <li><input type="submit" value="Register" /></li>
  </ul>
<?php echo '</form>' ?>
[/CODE]

Like I said, I really wish there was a cleaner implementation to
this.  One I was thinking of was being able to set the "rowDecorator"
on a specific widget
$this->widgetSchema['profile']->setRowFormat("\n  %error%%label%\n
%field%%help%\n%hidden_fields%\n");
notice I removed the <li></li>

Any other ideas on a better way to do this would be greatly
appreciated. I'm thinking this has to be a common problem?  Or are
most people just solving it through css and I should  tell my html/css
coders to deal with it?

--
Stephen Ostrow <[email protected]>

On Jan 23, 3:44 pm, jukea <[email protected]> wrote:
> yes, it's because the nested form is rendered as a row itself, with
> the widget being the whole form .
>
> I guess you might be able to do that by displaying each embedded form
> row like this
>
> $this->embedded_forms['myForm']['embedded_form_username']->renderRow
> ();
>
> (check sfFormDoctrine (or propel ) to verify embedded_form, i'm not
> sure)
>
> Julien
>
> On Jan 23, 2:08 pm, isleshocky77 <[email protected]> wrote:
>
> > I've run across this problem a few times now. I have a form with an
> > embedded form.  But I want it to displayed without being nested within
> > the form.
>
> > So instead of:
> > [code]
> > <ul>
> >   <li><input id="form[field]" /></li>
> >   <li>
> >     <ul>
> >       <li><input id="embedded_form[field]" /></li>
> >     </ul>
> >   </li>
> > </ul>
> > [/code]
>
> > I would like just:
> > [code]
> > <ul>
> >   <li><input id="form[field]" /></li>
> >   <li><input id="embedded_form[field]" /></li>
> > </ul>
> > [/code]
>
> > I had tried just doing this:
> > [code]
> > <?php foreach ($form->getFormFieldSchema() as $field ) : ?>
> >   <?php echo $field->renderRow() ?>
> > <?php endforeach; ?>
> > [/code]
>
> > but it still nests the form.  So I'm thinking I might be able to build
> > a new decorator, but I'm not sure if that will still nest the form.
>
> > And I'm trying to stay away from doing every field manually.
>
> > Thanks for any help
>
> > --
> > Stephen Ostrow
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to