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:

- sfForm : Controller
- sfValidator* : Model
- sfWidget* : View

So, the binding belongs to the Controller, not the model as you use the 
request:

class UserActions extends sfActions
{
   function executeLogin($request)
   {
     $this->form = new LoginForm();

     if ($request->isMethod('post'))
     {
       $this->form->bind($request->getParameter('login'));
       if ($this->form->isValid())
       {
         // do something useful with $this->form->getValues()
       }
     }
   }
}

As far as internationalization is concerned, the best way to handle it 
is in the view. You won't be able to just use echo $form, but it's 
pretty simple to handle. See this slide for some examples: 
http://www.aide-de-camp.org/talk/7/international-php-conference-2007?position=77

HTH,
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:
> Hi all,
> 
> Because the new form system is new, I'm going to paste my whole form, 
> partly for example..
> 
> 
>    class LoginForm extends sfForm
>    {
>      public function configure()
>      {
>        $schema =  new sfWidgetFormSchema(array(
>          'login_username' => new sfWidgetFormInput(),
>          'login_password' => new sfWidgetFormInputPassword(),
>        ));
> 
>        $schema->setLabel('login_username', 'Username');
>        $schema->setLabel('login_password', 'Password');
> 
>        $this->setWidgetSchema($schema);
> 
>        $this->setValidatorSchema(
>          new sfValidatorSchema(array(
>            'login_username' => new sfValidatorString(),
>            'login_password' => new sfValidatorString(),
>          )));
>      }
> 
>      public function bind($vars)
>      {
>        $request = sfContext::getInstance()->getRequest();
>        if ($request->hasParameter(self::$CSRFFieldName))
>        {
>          $vars[self::$CSRFFieldName] = 
> $request->getParameter(self::$CSRFFieldName);
>        }
>        parent::bind($vars);
>      }
>    }
> 
> 
> Here you can see i'm creating a simple form, 2 fields, both with defined 
> labels.
> 
> However, the labels for these forms aren't printed though the __() 
> function for i18n to take place.
> 
> Not sure if this is a bug, a feature I'm missing, or somethign the form 
> widgets just simply shouldn't be doing.
> 


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

Reply via email to