あなたは示されているようにそれを行うことができます
あなたのビューファイル
<div class="row rememberMe" id="CHECKBOX">
<?php echo $form->checkBox($regForm,'agree'); ?>
<?php echo $form->label($regForm,'agree'); ?>
<?php echo CHtml::link("terms and Conditions",array('message/goodbye'));?>
<?php echo $form->error($regForm,'agree'); ?>
</div>
以下に示すように、cform モデルを拡張するフォームを作成します。
ビューのRegisterationFormモデルを渡します
$regForm =new RegistrationForm
そして、あなたの登録フォームでは、次のようにします
class RegistrationForm extends CFormModel
{
public $agree;
public function rules()
{
return array(
array('agree', 'required', 'requiredValue' => 1, 'message' => 'You should accept term to use our service'),
);
}
public function attributeLabels(){
'agree' => 'I agree the',
}