views:

25

answers:

0

Hi,

I have a problem with my form and ajax.

Indeed, when the form is correctly fillin, datas are send into the database, but when the form is not correctly fillin, the errors "this input is required..." are never displayed (in spite of I have a validator for this).

This is my code of my action.class :

public function executeDetails()
{
$c = new Criteria();
$c -> add(ReunionPeer::ID_REUNION,
      $this->getRequestParameter('id'));
$this->zone = ReunionPeer::doSelectOne($c);

}

public function executeAjoutvalid()
{

$inscrit=new InscritReunion();
$inscrit->setIdReunion($this->getRequestParameter('id_reunion'));
$inscrit->setMailInscrit($this->getRequestparameter('mail'));
$inscrit->save();

}

public function handleErrorAjoutvalid()
{
    return sfView::ERROR;

}

And this is the code of my template :

<div id="statut_inscription" style="display:none">
<?php if ($sf_request->hasErrors()): ?>
  <p><? echo ('Form not correct !!')?> :</p>
  <ul>
    <?php foreach($sf_request->getErrors() as $name => $error): ?>
      <ol><?php echo $error ?></ol>
    <?php endforeach; ?>
  </ul>
<?php endif ?>
</div>
<div id="inscription_reunion">


<?php 


echo form_remote_tag(array(
    "url" =>'reunion/ajoutvalid',
    'update'  => array('success' => 'statut_inscription',  'failure' => 'statut_inscription'),
    'script'  => true,
    'loading' => "Element.show('indicator')",
    'success' => "Element.hide('indicator');Element.show('statut_inscription');Element.hide('inscription_reunion');",
    'failure' => "Element.hide('indicator');"), array( "name" => "ajoutvalid"));

//Then, I have the inputs and the submit button

?>

And this te url to see my form :

http://myproject/reunion/details/id/4

Have you an idea ?