Here your example modified to work out of the box: class authActions extends sfActions { public function executeLogin($request) { // allows a username to be passed in the URL as a GET param. $this->form = new LoginForm(array('login_username' => $username));
// if the form was posted... if ($request->isMethod('post')) { $this->form->bind($request->getParameter('login')); if ($this->form->isValid()) { die('merp'); } } } } and modify your form class like this: class LoginForm extends sfForm { public function configure() { // ... your stuff here $this->widgetSchema->setNameFormat('login[%s]'); } } So, every field is now in an array (and the CSRF field is also there). As an added bonus, the action does not have field name harcoded. Fabien -- Fabien Potencier Sensio CEO - symfony lead developer http://www.sensiolabs.com/ http://www.symfony-project.com/ Sensio Labs Tél: +33 1 40 99 80 80 Ian P. Christian wrote: > Ian P. Christian wrote: >> Fabien POTENCIER wrote: >>> Hi Ian, >>> >>> As the form framework is new, some comments: >>> >>> Don't override the bind() method like this. One of the property of the >>> new framework is a very clear separation between 3 layers: >> I am doing that in my action - but the main issue is that unless I bind > > Sorry, should have been a little more specific here.. > > My action consists of this: > > class authActions extends sfActions > { > public function executeLogin($request) > { > $form = new LoginForm(); > > // allows a username to be passed in the URL as a GET param. > if ($username = $request->getParameter('login_username')) > { > $form->setDefaults( array( 'login_username' => $username)); > } > > // if the form was posted... > if ($request->isMethod('post')) > { > $form->bind( > array( > 'login_username' => $request->getParameter('login_username'), > 'login_password' => $request->getParameter('login_password'), > )); > > if ($form->isValid()) > { > die('merp'); > } > } > $this->form = $form; > } > } > > > > But, as that is the form will error becuase of the CSRF field not being > bound. > > As such, I moved that logic into the LoginForm class, as notjosh > suggseted doing in his blog (also stating that that might well not be > the right way). > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---