ajaxSubmitButton is not passing all variables

In the view:


<?php $hsz_form = $this->beginWidget('CActiveForm', array(

	'id'=>'hsz_form',

	'enableAjaxValidation'=>true,

	'enableClientValidation' => true,

	'focus' => array($hsz_model, 'comment'),

));  ?>

<div id="hozzaszol" style="text-align: center;" class="form">

	<?php echo $hsz_form->labelEx($hsz_model,'comment'); ?>

	<?php echo $hsz_form->textArea($hsz_model, 'comment', array('cols'=>'50', 'rows'=>'5')); ?>

	<?php echo $hsz_form->error($hsz_model,'comment'); ?>

	<?php echo $hsz_form->hiddenField($hsz_model, 'game_id', array('value'=>$model->id)); ?>

	<br />

	<?php echo CHtml::ajaxSubmitButton('Küldés', array('jatek/hozzaszol'), array('update'=>'#uj_hsz'), array('onclick'=>'$("#Hozzaszol_comment").val("");')); ?>

</div>

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

In controller when I print out the $_REQUEST, I see the following: Array ( [Hozzaszol] => Array ( [comment] => [game_id] => 106 ) )

So the game_id variable is sent alright, while the comment is not. Why is that?

You need to check the datatype of your comment model

What do you exactly mean?

Actually, you need to look at the part of your code




array('onclick'=>'$("#Hozzaszol_comment").val("");')



So, this says that set empty the value of comment so you got null value…

Happy coding…

That was it. Thanks very much! ;)