Hii,
I’m new to yii and I need some help, I’m trying to update data inside a CJuiDialog and ajax but it seems that the server doesn’t get back the POST data.
If i’m trying the same but put the CJuiDialog part comment out it’s work perfectly.
This is my code in the view file:
<?php
if ($model->isNewRecord)
{
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'catDialog',
'options'=>array(
'title'=>'Select Category:',
'closeOnEscape'=>false,
'resizable'=>false,
'modal'=>true,
),
)
);
echo $form->label($model,'category');
echo ": ";
echo $form->dropDownList($model,'category',$model->getCategories(),array('class'=>'catName'));
echo CHtml::ajaxSubmitButton(
'Choose',
array('article/updateCategory'),
array('update'=>'#cat_name'),
array('onClick'=>'$("#catDialog").dialog("close");')
);
$this->endWidget('zii.widgets.jui.CJuiDialog');
}
?>
</div>
<h2 id="cat_name"></h2>
and this is the one in the Controller:
public function actionUpdateCategory()
{
$model=new Article;
if(isset($_POST['Article']))
{
$model->attributes=$_POST['Article'];
echo CHtml::encode('Categroy: '.$model->categoryClass->name);
}
}
thanks.