Bonjour a tous !

J'ai depuis hier quelque soucis avec la validation d'un formulaire de contact. Le problème est le suivant : ma fonction isValid() renvoie tjrs false pour une raison que je ne comprends pas ! Voici quelque extraits de mon code :

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
public function executeIndex($request)
  {
    $this->form = new ContactForm();
	if ($request->isMethod('post'))
    {	$this->form->bind($request->getParameter('contact'));
	  if ($this->form->isValid())
      {      
		$this->redirect('contact/thankyou?'.http_build_query($request->getParameter('contact')));
	  }
	}
 }
 
  public function executeThankyou()
  {
  }
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<div id="form">
<form id="mycontactform" action="<?php echo url_for('contact/index') ?>" method="POST">
  <table>
      <tr>
      <th>Civilité</th>
	<td><?php echo $form['civil']?>
	     <?php echo $form['civil']->renderError() ?></td>
        </tr>
        <tr>
        <th>Nom</th>
	  <td><?php echo $form['nom']?>
	     <?php echo $form['nom']->renderError() /></td>
        </tr>
        <tr>
        <th>Prénom</th>
        <td><?php echo $form['prenom']?>
	<?php echo $form['prenom']->renderError() ?></td>
            <th>Fonction</th>
       <td><?php echo $form['fonction']?>
	<?php echo $form['fonction']->renderError() ?></td>
      <th>Société</th>
      <td><?php echo $form['societe']?>
	<?php echo $form['societe']->renderError() ?></td>
       </tr>
       <tr>
       <th>Téléphone</th>
        <td><?php echo $form['tel']?>
	<?php echo $form['tel']->renderError() ?></td>
	<th>Email</th>
	<td><?php echo $form['email']?>
	<?php echo $form['email']->renderError() ?></td>
	</tr>
	<tr>
	<th>CP</th>
	<td><?php echo $form['CP']?>
	<?php echo $form['CP']->renderError() ?></td>
	<th>Ville</th>
	<td><?php echo $form['ville']?>
	<?php echo $form['ville']->renderError() ?></td>
	</tr>
	<tr>
	<th>Objet</th>
	<td><?php echo $form['objet']?>
	<?php echo $form['objet']->renderError() ?></td>
	</tr>
	<tr>
	<th>Message</th>
	<td><?php echo $form['message']?>
	<?php echo $form['message']->renderError() ?></td>
	<th></th>
	<td><input type="submit" id="submit" value="<?php echo __('Envoyer'); ?>"/></td>
	</tr>
     </table>
  </form>
</div>
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class ContactForm extends BaseForm
{
 protected static $civil = array('Mme'=>'Mme', 'Mlle'=>'Mlle', 'Mr'=>'M.');
 protected static $objet = array('tech'=>'Demande Technique', 'quot'=>'Quotations', 'devis'=>'Devis', 'ind'=>'Demande Industrielle', 'emplois'=>"Demande d'emplois");
 
  public function configure()
  {
    $this->setWidgets(array(
	  'societe' => new sfWidgetFormInputText(),
	  'civil' => new sfWidgetFormSelect(array('choices' => self::$civil)),
      'nom' => new sfWidgetFormInputText(),
	  'prenom' => new sfWidgetFormInputText(),
	  'fonction'  => new sfWidgetFormInputText(),
	  'tel' => new sfWidgetFormInputText(),
      'email' => new sfWidgetFormInputText(),
	  'ville' => new sfWidgetFormInputText(),
	  'CP' => new sfWidgetFormInputText(),
	  'objet' => new sfWidgetFormSelect(array('choices' => self::$objet)),
      'message' => new sfWidgetFormTextarea(),
    ));
	$this->widgetSchema->setLabels(array(
	 'societe' => 'Société',
	 'civil' => 'Civilité',
	 'nom' => 'Nom',
	 'prenom' => 'Prénom',
	 'fonction' => 'Fonction',
	 'tel' => 'Téléphone',
	 'email' => 'Email',
	 'ville' => 'Ville',
	 'CP' => 'Code Postal',
	 'objet' => 'Objet',
	 'message' => 'Votre demande',
	 ));
	$this->setValidators(array(
	    'societe' => new sfValidatorString(array('max_length' => 50),array('required' => 'Ce champs est obligatoire')),
		'civil' => new sfValidatorChoice(array('choices' => array_keys(self::$civil)),array('required' => 'Ce champs est obligatoire')),
		'nom' => new sfValidatorString(array('max_length' => 50),array('required' => 'Ce champs est obligatoire')),
		'prenom' => new sfValidatorString(array('max_length' => 50),array('required' => 'Ce champs est obligatoire')),
		'fonction' => new sfValidatorString(array('max_length' => 50),array('required' => 'Ce champs est obligatoire')),
		'tel' => new sfValidatorString(array('max_length' => 50),array('required' => 'Ce champs est obligatoire')),
		'email' => new sfValidatorEmail(array(), array('invalid' => 'Veuillez saisir une adresse mail valide.', 'required' => 'Ce champs est obligatoire')),
		'ville' => new sfValidatorString(array('max_length' => 50),array('required' => 'Ce champs est obligatoire')),
		'CP' => new sfValidatorString(array('max_length' => 50),array('required' => 'Ce champs est obligatoire')),
		'objet' => new sfValidatorChoice(array('choices' => array_keys(self::$objet)),array('required' => 'Ce champs est obligatoire')),
		'message' => new sfValidatorString(array('max_length' => 255),array('required' => 'Ce champs est obligatoire')),
	));	
	$this->widgetSchema->setNameFormat('contact[%s]');
  }
}
Si l'un d'entre vous à la solution, je suis preneur ! J'ai cherché tte la journée d'hier sans succès ! Merci d'avance pour vos réponses !