Post Data Don't Submit

Hi Community!

Just got a small issue, I’ve got a form with 2 items, dropdown & datepicker which are supposed to send an ajax request to a specific action on change, the ajax request is actually sent, however there’s no $_POST data in it and I am wondering why!

Some Code …

index.php:




<div class="well">

	<h4 class="no_shadow">Welcome, <?php echo Yii::app()->user->fullName; ?>!</h4><br />

	<?php $this->beginWidget('bootstrap.widgets.TbBox', array(

	    'title' => 'Your Appointments',

	    'headerIcon' => 'icon-info-sign',

	)); ?>

		<table id="filter">

			<tr class="pull-left">

				<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(

					'id'=>'filter-form',

					'enableAjaxValidation'=>false,

				)); ?>

					<td><?php echo $form->dropDownListRow($filter_form,'status', array(0, 1), array(

							'ajax'=>array(

								'type'=>'POST',

								'url'=>Yii::app()->createUrl('site/index'),

								'update'=>'#data_table',

							)

						)); ?>

					</td>

					<td>

						<?php echo $form->datepickerRow($filter_form, 'filter_to',

		        		array('prepend'=>'<i class="icon-calendar"></i>','ajax'=>array(

							'type'=>'POST',

							'url'=>Yii::app()->createUrl('site/index'),

							'update'=>'#data_table',

						))); ?>

					</td>

					<td></td>

					<td></td>

					<td></td>

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

			</tr>

		</table>

		<?php $this->renderPartial('_appointments', array('appointments'=>$appointments)); ?>

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

</div>



SiteController.php:




public function actionIndex()

	{

		if(!Yii::app()->request->isAjaxRequest)

		{

			$filter_form = new EAppointment;

			$appointments = EAppointment::model()->findAllByAttributes(array('creator_id'=>Yii::app()->user->id));

			$this->render('index', array('filter_form'=>$filter_form, 'appointments'=>$appointments));

		}

		else {

			//$filter_form = EAppointment::model()->findAllByAttributes(array('creator_id'=>Yii::app()->user->id));

			var_dump($_POST);

			die();

			$this->renderPartial('_appointments');

		}	

	}



_appointments.php:




<table id="data_table">

	<th>Next Contact</th>

	<th>Time</th>

	<th>Reason</th>

	<?php foreach($appointments as $appointment): ?>

		<tr class="<?php echo $i % 2 == 0 ? 'even' : 'odd'; ?>">

			<td><?php echo $appointment->next_contact; ?></td>

			<td><?php echo $appointment->etime; ?></td>

			<td><?php echo $appointment->reason; ?></td>

<?php endforeach; ?>

</tr>

</table>



according to firebug the request is sent to the Controller/Action, but the var_dump($_POST) returns an empty array while it should actually return EAppointment form object. Looks a bit odd to me, would be great if someone could give me a hand here.

Thanks in advance!

-Seb

have you checked the params passed in your request. Can you please show a screenshot of your firbug request.

just found the issue, for some reason the call is made but data are not beeing passed cause of the <table>

do you have any idea why? the request is sent in both cases, but $_POST is only passed if I remove the table around the dropdown which is sending the request.