Symfony: joining two forms in the same page

Posted by user248959 on Stack Overflow See other posts from Stack Overflow or by user248959
Published on 2010-04-23T12:39:21Z Indexed on 2010/04/23 12:43 UTC
Read the original article Hit count: 258

Filed under:
|

Hi,

i'm trying to join in the same action the login and the register forms. This is what i'm trying:

modules/miembros/actions.class.php

  public function executeAux(sfWebRequest $request)
  {
        // I execute this action

  }

modules/miembros/templates/auxSuccess.php

<?php include_component('sfGuardRegister', 'register'); ?>
<?php include_component('sfGuardAuth', 'signin'); ?>

modules/miembros/components.class.php

public function executeSignin($request)
{

  if ( $request->isMethod( 'post' ) && ($request-
>getParameter('submit')=='signin') ){

    $this->form->bind( $request->getParameter( 'login' ) );
    if ( $this->form->isValid() ){
      $this->getController()->getActionStack()->getLastEntry()->getActionInstance()->redirect( '@home' );
    }
  }

}

modules/miembros/templates/_signin.php

<form action="<?php echo url_for('miembros/aux?submit=signin') ?>"
method="post">

        <?php echo $form['email_address']->renderLabel() ?>
        <?php echo $form['email_address'] ?>
... 

It's working ok, but i would to know if you have other alternatives.

Regards

Javi

© Stack Overflow or respective owner

Related posts about symfony

Related posts about forms