activeCheckBox click on checkbox but still marked as unchecked and not change in $_POST

I want to load data depending on checkbox and try in this way.

echo CHtml::activeCheckBox($model,‘State’,

array(‘ajax’=>array(‘url’=>$this->createUrl(‘ad/AllState’),‘type’=>‘POST’)));

When I checked the checkbox then

there are two issues

  1. Checkbox always marked as unchecked.

  2. Wrong value in $_POST.

Please explain more the issue… how and when do you check the checkbox… what you mean with checkbox always marked as unchecked… if you click on the checkbox does it get checked?

what values do you get in $_POST and what values should be there ?

If I click on checkbox it does not checked.

I got 1 in $_POST.

Value should be 0 if unchecked and 1 if checked.

here is my requirement

I visited my form.

there are three checkboxes.(see attachment)

requirement is when user click on state filter checkbox then load data.

I am trying to use activeCheckBox for this.

I click on state filter checkbox many time but checkbox always unchecked and it sent request to controller and every time I got the value of checkbox as 1 in $_POST.

If there is a solution for our requirement please refer

Problem is the "ajax" usage… when you click the checkbox an ajax request is made for that checkbox… as you clicked it… the value of the checkbox is 1… but that is not shown on the display because by default false is returned from the ajax call…

Can you tell me the changes in my code?

I explained you above what is going on here…

To solve this… 2 possibilities comes to mind…

One would be to use a custom ajax code so that you do not return false at the end…

Second would be to update the checkboxes on ajax calls…