Hi list,

I am working with symfony 1.4 to build a simple registration form, I got 2
models for this part : Registration and Person, which works with standalone
generated modules.

The registration model has 2 one to one relations with person for recording
2 contact information (respectively named Participant and Contact). I want
to bring both contact informaiton in the same form, tied to registration
form in registration module. Altough registration records cannot be modified
directly in form, it has to be timestampped and update status once the form
user has registered.

I defined my form class like with this only method :
class FrontEndRegistrationForm extends BaseRegistrationForm
{
  public function configure()
  {
    //delete everything
     $this->setWidgets(array());
     $this->setValidatorSchema(new sfValidatorSchema());

     //adding 2 persons forms
     $participant = $this->getObject()->getParticipantPerson();
     $this->embedForm("participant", new
ParticipantPersonForm($participant));

     $contact = $this->getObject()->getContactPerson();
     $this->embedForm("contact", new ContactPersonForm($contact));
  }
}

ParticipantPersonForm and ContactPersonForm are both derivating from
BasePersonForm and aim to remove different unused fields.


My problem is the embeded forms are both named with the model name, which is
the same in this case (Person) . I though the first argument of the
embedForm method was use to prefix fields name in HTML rendering, but
apparently not.

Also, I tried adding in my sub-forms configure method the statement

$this->setOption('name_format', 'participant[%s]');

And $this->setOption('name_format', 'contact[%s]');

Nothing to do, I am stuck with field named contact[%s] and unable to
properly save forms data.
In my view file, I dumped the form vars and checked them, they seem ok for
widgets/validators and using the right classes (ParticipantPersonForm &
ContactPersonForm) But both have the default option for 'name_format'
whatever I tried.

Did I do something wrong in the implementation ?
Is there any other way to get this working ?

Best regards,
Benoit
--
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