Dear friends,

I need your help about the form validator in admin generated module... I'm trying understood today and dont know anything.
When I have the action SAVE (save.yml)

methods:
  post:
    - "curso{curso_nome}"

fillin:
  enabled:              true

names:
  curso{curso_nome}:
    required:           true
    required_msg:       Informe o NOME do curso
    sfStringValidator:
      min:              5
      min_error:        NOME muito pequeno (mínimo 2 letras)
      max:              100
      max_error:        NOME muito grande (máximo 50 letras)

the generator make a only check
...
else if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
  $validators = array();
  $validatorManager->registerName('curso_nome', 1, 'Informe o NOME do curso', 'curso', null, false);
  $this->context->getRequest()->setAttribute('symfony.fillin', array (
  'enabled' => true,
));
}

The code is OK but don't do any other verify (min or max length)

But when I change the action SAVE to

methods:                [post]

fillin:
  enabled:              true

names:
  curso{curso_nome}:
    required:           true
    required_msg:       Informe o NOME do curso
    sfStringValidator:
      min:              5
      min_error:        NOME muito pequeno (mínimo 2 letras)
      max:              100
      max_error:        NOME muito grande (máximo 50 letras)

The generator make the follow code

else if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
  $validators = array();
  $validators['required_msg_curso{curso_nome}'] = new required_msg($this->context, null);
  $validators['sfStringValidator_curso{curso_nome}'] = new sfStringValidator($this->context, array (
  'min' => 5,
  'min_error' => 'NOME muito pequeno (mínimo 2 letras)',
  'max' => 100,
  'max_error' => 'NOME muito grande (máximo 50 letras)',
));

  $validatorManager->registerName('curso_nome', 1, '', 'curso', null, false);
  $validatorManager->registerValidator('curso_nome', $validators['required_msg_curso{curso_nome}'], 'curso');
  $validatorManager->registerValidator('curso_nome', $validators['sfStringValidator_curso{curso_nome}'], 'curso');

  $this->context->getRequest()->setAttribute('symfony.fillin', array (
));
}

But the code is not running, what is wrong???
Sorry by long email and code...


Medeiros

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