it is becuse when checkbox is not checked, referred value is not send to server on submit. When it is checked - it will overwrite value from hidden field.
Well, I don’t understand how the browser knows overwrite the value. Is required some plugin? If I just only render a form without javascript these “overwrite happens”?
I’m pretty sure the browser has nothing to do with that, since this happens in the server-side.
It’s the first time I read about this feature, don’t know if it overrides the value automatically when using $model->attributes or you have to manually set the attribute value with the value of the unchecked input, to figure it out you could try and see what you get by setting the uncheckvalue to a random value and then dumping your model attributes value after doing the $model->attributes statement in your controller. If your model attribute has the same value you defined for the checkbox uncheckvalue option, then it’s done automatically.
I didn’t know the trick of hidden fields for checkboxes. And I had to reconstruct the values of them using something like “$value = (isset($something) && $something === true);”.