Во вьюхе делаю так
Код: Выделить всё
<?php echo $form->dropDownList($model, 'parent_id', CHtml::listData(Section::model()->getList()->getData(), 'id', 'title'), array('encode' => false, 'onchange'=>Chtml::ajax(array('type'=>'POST','url' => CController::createUrl('sectionType'),'update' => '#'.CHtml::activeId($model, 'comments_allowed'))),'empty'=>t('Выберите раздел для публикации'))); ?>
<?php echo $form->checkBox($model, 'comments_allowed', array()); ?>
Код: Выделить всё
public function actionSectionType()
{
$parent_id = $_POST['Articles']['parent_id'];
$data = Section::model()->find('parent_id=:parent_id AND type=:type', array(':parent_id'=>$parent_id, ':type'=>'blogs'));
if ($data != null){
echo CHtml::tag('option', array('value' => 1, 'uncheckValue'=>0, 'checked' => true), true);
} else {
echo CHtml::tag('option', array('value' =>1, 'uncheckValue'=>0), true);
}
}
В чем проблема?syntax error