I am using two two form submitted by ajaxSubmitButton. Only one of them is working fine( the one coming earlier on page. review-form in this case). No request is being captured for the other form. Instead the page is just refreshing. What is causing the problem and how can I make it work? I am only showing the relevant file i.e view file.
<?php
$modelR = new Review;
$formR=$this->beginWidget('CActiveForm', array(
'id'=>'review-form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>true,
)); ?>
<div class="row">
<?php echo $formR->labelEx($modelR,'review'); ?>
<?php echo $formR->textArea($modelR,'review',array('size'=>60,'maxlength'=>255)); ?>
<?php echo $formR->error($modelR,'review'); ?>
</div>
<div class="row">
<?php echo CHtml::ajaxSubmitButton($modelR->isNewRecord ? 'Ok' : 'Save',"/blog/index.php/review/submit",
array('success'=>'js:function(data){
$("div.errorMessage").append(data);}'
),
array('id'=>'review','name'=>'review')
);?>
</div>
<?php $this->endWidget(); ?>
<?php
$model = new Add;
$form=$this->beginWidget('CActiveForm', array(
'id'=>'add-form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>true,
'clientOptions'=>array('validateOnSubmit'=>true),
));?>
<div class="row">
<?php echo $form->labelEx($model,'comment'); ?>
<?php echo $form->textField($model,'comment',array('size'=>60,'maxlength'=>255)); ?>
<?php echo $form->error($model,'comment'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::ajaxSubmitButton($model->isNewRecord ? 'Create' : 'Save',"/blog/index.php/add/submit",
array('success'=>'js:function(data){
$("div.errorMessage").append(data);
}'),
array('id'=>'add','name'=>'add')
);?>
</div>
<?php $this->endWidget(); ?>