CActiveForm checkBox problem

Hello everyone.

I have a problemm with CActiveForm checkBox. Namely I can’t get rid of a hidden field that it generates.

Can anyone help me with this?


This hidden field is necessary and cannot be removed.

Leave it where it is, wihtout this hidden field the checkbox is now working properly.

Why does it not work then?

echo $form->checkBox($model,'typ',array('class'=>'checkbox','value'=>'admin'));

It just does not send ‘admin’ when the checkbox is checked. What can be wrong?

Without the hidden field is not working when you do CActiveRecord->setAttributes() (if you want to use CActiveRecord).

If the model hase ‘typ’=admin in db and you want to unset, it will not unset because nothing is posted and so the attribute will not be set.

The hidden field ensure that will be posted 0 if the checkbox is not checked, and so is possible to use CActiveRecord->setAttributes()