In my Yii project, I’m trying to use a checkBoxList to update another field in a form. But I’m having some issues if I add Ajax to update the other field.
Without Ajax, I can check and uncheck the items normally. With Ajax, the site sends the request, but the checkbox remains unchecked.
Example:
$selected = array(
    'item1_1',
    'item1_2',
);
$data = array(
    'item1'=>'test item 1',
        'item1_1'=>'test item 1.1',
        'item1_2'=>'test item 1.2',
        'item1_3'=>'test item 1.3',
    'item2'=>'test 2',
        'item2_1'=>'test item 2.1',
        'item2_2'=>'test item 2.2',
    'item3'=>'test item 3'
);
echo CHtml::checkBoxList('checklistbox_test',
    $selected,
    $data, 
    array(
        'class'=>'checklistbox_test_item',
        'ajax'=> array(
            'type'=>'POST',
            'url'=>Yii::app()->createUrl('site/contact'),
            'update'=>'#update_other_field',
            'data'=>array('filter_selected' => 'js:$(this).val()'),
        ),
    )
);
Maybe I would have to return that the item can be checked? But how?
Someone knows why this happens?