Bonjour,

J'ai form Comment qui lorsqu'il est incomplet ne renvoie pas d'erreur personnalisé du type: "Il manque un commentaire".

J'ai ce message d'erreur à la place dans une page blanche:
Notice: Undefined variable: comment in C:\Application\Programmation\Sites\dev2\apps\frontend\modules\comments\templates\showSuccess.php on line 5

Fatal error: Call to a member function getId() on a non-object in C:\Application\Programmation\Sites\dev2\apps\frontend\modules\comments\templates\showSuccess.php on line 5
Mon form Comment:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class commentForm extends BasecommentForm
{
  public function configure()
  {
  	
  	$this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'contact_id' => new sfWidgetFormInputHidden(),//new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('contact'), 'add_empty' => true)),
      'etio_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('etios'), 'expanded' => true), array('class' => 'radio_line')),
      'content'    => new sfWidgetFormTextarea(),
      
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'contact_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('contact'), 'required' => true), array('required' => 'Un(e) client(e) doit être renseigné(e).')),
      'etio_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('etios'), 'required' => true), array('required' => 'Un(e) étiopathe doit être renseigné(e).')),
      'content'    => new sfValidatorString(array('max_length' => 20000, 'required' => true), array('required' => 'Le commentaire est obligatoire.')),
     
    ));
    
    $this->widgetSchema->setLabels(array(
	  'contact_id'    => 'Client',
	  'etio_id'   => 'Etiopathe',
	  'content' => 'Commentaire',
	));

    $this->widgetSchema->setNameFormat('comment[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    //$this->setupInheritance();
    
  }
}
Mes autres formulaires réagissent bien en modifiant ici.

Remarque (peut-être constructive):
Ce commentForm se trouve dans une page avec un contentForm.

Je ne sais pas trop où chercher pour déboguer ceci.

Merci d'avance,
Laurent.