Bonjour,

Mon écran principal est une liste de contacts. Je clique sur un contact pour accéder à sa fiche où je peux enregistrer un message pour ce contact.

Le problème est que je dois re-choisir le contact parmi la liste de mon écran précédent via une drop-down list.
Si je supprime le widget du form, je ne peux plus enregistrer un commentaire (message d'erreur).

Voilà mon commentForm.class.php
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
public function configure()
  {
 
  	$this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      //'contact_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('contact'), 'add_empty' => true)),
      'etio_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('etios'), 'add_empty' => false)),
      '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' => false)),
      'etio_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('etios'))),
      'content'    => new sfValidatorString(array('max_length' => 20000, 'required' => false)),
 
    ));
 
    $this->widgetSchema->setNameFormat('comment[%s]');
 
    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 
    $this->setupInheritance();
 
  }
Comment garder l'id de mon contact sans le widget? cet id est bien envoyé via l'url de la page principale.