Problem Ajax Forms

hi first sorry for my bad english.

I have 2 ajax forms in the same view, and the problem is only one form works.

the form on the top, the form in the bottom does not work.

but if i move the form in the bottom to top or if I delete any form, the other form works

so the forms work OK,

but i don’t know why just one form works in the view.

this is the code




 <?php

      $formContact = $this->beginWidget('CActiveForm', array(

        'id'=>'contacts-form',

        'enableAjaxValidation'=>true,

        'action'=>$this->createUrl('contacts/create'),

        'enableClientValidation'=>false,

        ));

       ?>      

        <div class="form-group">

          <?php echo $formContact->labelEx($contactModel,'author'); ?>

          <?php echo $formContact->textField($contactModel,'author',array('size'=>50,'maxlength'=>50,'class'=>'form-control')); ?>

          <?php echo $formContact->error($contactModel,'author'); ?>

        </div>

 

        <div class="form-group">

          <?php echo $formContact->labelEx($contactModel,'email'); ?>

          <?php echo $formContact->textField($contactModel,'email',array('size'=>50,'maxlength'=>50,'class'=>'form-control')); ?>

          <?php echo $formContact->error($contactModel,'email'); ?>

        </div>

 

        <div class="form-group">

          <?php echo $formContact->labelEx($contactModel,'phone'); ?>

          <?php echo $formContact->textField($contactModel,'phone',array('size'=>20,'maxlength'=>20,'class'=>'form-control')); ?>

          <?php echo $formContact->error($contactModel,'phone'); ?>

        </div>

 

        <div class="form-group">

          <?php echo $formContact->labelEx($contactModel,'message'); ?>

          <?php echo $formContact->textArea($contactModel,'message',array('rows'=>6, 'cols'=>50,'class'=>'form-control')); ?>

          <?php echo $formContact->error($contactModel,'message'); ?>

        </div>

 

        <div class="checkbox">

          <label>

           <?php echo $formContact->checkBox($contactModel,'term_conditions',array()); ?>

           <a href="" class="term-cond">Acepto condiciones de uso y politica de privacidad</a>

         </label>

       </div>

       <?php echo $formContact->error($contactModel,'term_conditions'); ?>

       <?php echo CHtml::ajaxSubmitButton('enviar',CHtml::normalizeUrl(array('contacts/create')),

         array(

           'dataType'=>'json',

           'data'=>'js:jQuery("#contacts-form").serialize()+"&YII_CSRF_TOKEN='.Yii::app()->request->csrfToken.'"',  

           'type'=>'post',

           'success'=>'function(data) {

           $("#ajax-contact-loader").hide();  

           if(data.status=="success"){              

             $("#contacts-form").html("<div class=\"alert alert-success\"> MENSAJE ENVIADO CAMBIAR ESTO.</div>");

             $("#contacts-form")[0].reset();

           }

           else{

             $(".errorMessage").text("");

             $.each(data, function(key, val) {                

               $("#contacts-form #"+key+"_em_").text(val);                                                    

               $("#contacts-form #"+key+"_em_").show();

             });

      }      

    }',                    

     'beforeSend'=>'function(){                        

      $("#AjaxLoader").show();

    }'

     ),array('class'=>'btn btn-default')); ?>

 

     <?php $this->endWidget(); ?>

 

______________________________________________________________________________________

 

   <?php

        $formReport = $this->beginWidget('CActiveForm', array(

          'id'=>'ads-reports-form',

          'enableAjaxValidation'=>true,

          'action'=>$this->createUrl('adsReports/create'),

          'enableClientValidation'=>false,

          ));

          ?>

   

          <div class="form-group">

            <?php echo $formReport->labelEx($adsReportsModel,'reason'); ?>

            <?php echo $formReport->textField($adsReportsModel,'reason',array('size'=>50,'maxlength'=>50,'class'=>'form-control')); ?>

            <?php echo $formReport->error($adsReportsModel,'reason'); ?>

          </div>

          <div class="form-group">

            <?php echo $formReport->labelEx($adsReportsModel,'message'); ?>

            <?php echo $formReport->textArea($adsReportsModel,'message',array('rows'=>6, 'cols'=>50,'class'=>'form-control')); ?>

            <?php echo $formReport->error($adsReportsModel,'message'); ?>

          </div>

        </div>

        <div class="modal-footer">

         <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>

         <?php echo CHtml::ajaxSubmitButton('enviar',CHtml::normalizeUrl(array('adsReports/create')),

           array(

             'dataType'=>'json',          

             'data'=>'js:jQuery("#ads-reports-form").serialize()+"&YII_CSRF_TOKEN='.Yii::app()->request->csrfToken.'"',  

             'type'=>'post',

             'success'=>'function(data) {

             // $("#ajax-contact-loader").hide();  

             if(data.status=="success"){              

               $("#ads-reports-form").html("<div class=\"alert alert-success\"> MENSAJE ENVIADO CAMBIAR ESTO.</div>");

               $("#ads-reports-form")[0].reset();

             }

             else{

               $(".errorMessage").text("");

               $.each(data, function(key, val) {                

                 $("#ads-reports-form #"+key+"_em_").text(val);                                                    

                 $("#ads-reports-form #"+key+"_em_").show();

               });

        }      

      }',                    

       'beforeSend'=>'function(){                        

       alert();

        // $("#AjaxLoader").show();

      }'

       ),array('class'=>'btn btn-success')); ?>

 

     </div>

 

     <?php $this->endWidget(); ?>



thanks