Thanks for your reply again but myself found the error. My code is wrong 
completely. See the code for the action now:

public function executeAdicionarAutor($request)
{
        $this->formulario_autores = new AutoresForm();
        if ($request->isMethod('post')) {
                
$this->formulario_autores->bind($request->getParameter('nombre'));
                if ($this->formulario_autores->isValid()) {
                        $autor = new Autores();
                        
$autor->setNombreAutor($request->getParameter('nombre'));
                        $autor->save();
                        $this->redirect('@listar_autores');
                }
        } 
}

Now it validates OK but I have one doubt. I have the csrf_secret protection 
active. Now when I send the form always appear this message: "csrf token: 
Required." and the form never is send. What this mean that I need a field for 
insert the secret word or something else?

Cheers and thanks in advance
Ing. Reynier Pérez Mira
Grupo de Soporte al Desarrollo - Dirección Técnica IP 

> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
> On Behalf Of Ant Cunningham
> Sent: Thursday, October 09, 2008 7:37 PM
> To: [email protected]
> Subject: [symfony-users] Re: sfForms doesn't validate
> 
> 
> Im not sure that this has anything to do with it... But why are you
> extending the base class? Normal procedure is to extend the generated
> form class.
> 
> 
> Reynier Perez Mira wrote:
> > Hi every:
> > I created a Forms based on a Propel Model and using the propel:build-forms 
> > task. I
> try to personalize a little more the generated form adding some rules for 
> validation.
> See the code below:
> >
> > class BaseAutoresForm extends BaseFormPropel
> > {
> >    public function setup()
> >    {
> >       $this->setWidgets(array('nombre_autor' => new sfWidgetFormInput()));
> >       $this->setValidators(array('nombre_autor' => new
> sfValidatorString(array('required'=>true,'min_length'=> 
> 4,'max_length'=>50))));
> >       $this->widgetSchema->setNameFormat('autores[%s]');
> >       $this->errorSchema = new 
> > sfValidatorErrorSchema($this->validatorSchema);
> >       parent::setup();
> >     }
> >
> >    public function getModelName()
> >    {
> >        return 'Autores';
> >    }
> > }
> >
> > So this code when I leave a blank field must be validate but it doesn't 
> > work because
> the form is always send. I try also writing only 3 characters (for 
> min_lenght) and
> doesn't work too.
> >
> > What I'm doing wrong?
> > Cheers and thanks in advance
> > Ing. Reynier Pérez Mira
> > Grupo de Soporte al Desarrollo - Dirección Técnica IP
> >
> >
> > >
> 
> 
> --
> Ant Cunningham
> Graphic Designer | Web Developer
> Vector Based Design
> 
> 

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