Checkbox Not Passing Validation. 2 Values For The Same Field In Post

I am having trouble getting a checkBox to pass validation, and the problem seems to be related to the hidden field that is created for checkboxes to be sure that some value is passed, even if the user doesn’t check the checkBox.

I have a registration form with a checkbox:

	<div class="row">

		<?php echo $form->labelEx($model, 'terms_agreed'); ?>

		<?php echo $form->checkBox($model,'terms_agreed', array('uncheckValue' => 0)); ?>

		<?php echo $form->error($model,'terms_agreed'); ?>


This checkbox corresponds to the database field ‘terms_agreed’, which is tinyint(1), not null, and default 0.

In the model, I have a rule that is supposed to require that the checkbox be checked:

array('terms_agreed', 'required', 'requiredValue' => 1, 'message' => 'You must agree to the Terms of Service'),

In my controller, I have

	public function actionRegister()


		$uniqname = User::get_uniqname();

                $person = Person::find_by_uniqname($uniqname); 




			Yii::log('POST[person][terms_agreed] = ' . $_POST['Person']['terms_agreed'], 'info','system.debug');



$_POST[‘Person’][‘terms_agreed’] is always 0, and the form never passes validation. Interestingly, Firebug shows that the Post actually has two values set for terms_agreed - the first value is 1 and the second value is 0:

Person[terms_agreed]	1

Person[terms_agreed]	0

I know that the way checkBox is supposed to work is that it creates a hidden field that has the default value, in case the user doesn’t click the checkbox, but that value is supposed to be overridden if the user does check the checkbox. Somehow, it seems like the hidden field is overriding the real field. I’ve tried using uncheckValue in the form:

<?php echo $form->checkBox($model,'terms_agreed', array('uncheckValue' => 0)); ?>

When I set the value to 0, the form fails validation with the message from the rule above (You must agree to the Terms of Service). When I set the uncheckValue to 1, the form validated, but I can’t have a default be that the user agrees to the terms and conditions.

Any help would be appreciated.