I have a user registration form, to submit the user needs to fill out 2 fields that are NOT in the database (agreement and passwordTwo).
These are both active fields for my user registration form. Upon insertion to the database it seems to be failing (but validating), I believe it is because the agreement and passwordTwo fields don’t exist in the database and it is adding them into the sql command.
So my question is, how should i go about validation of these fields without screwing with yii’s generated sql string?
form
<div class="simple">
<?php echo CHtml::activeLabel($model,'password'); ?>
<?php echo CHtml::activePasswordField($model,'password'); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabel($model,'passwordTwo'); ?>
<?php echo CHtml::activePasswordField($model,'passwordTwo'); ?>
</div>
form
<div class="action">
<?php echo CHtml::activeLabel($model,'agreement'); ?>
<?php echo CHtml::activeCheckBox($model,'agreement'); ?>
<br/>
<?php echo CHtml::submitButton('Register'); ?>
</div>
User.php (model)
// on register
array('password', 'compare', 'compareAttribute'=>'passwordTwo','message'=>'Password field must match.', 'on'=>'register'),
array('password', 'required', 'on'=>'register'),
array('agreement', 'compare', 'compareValue'=>'1', 'message'=>'You must sign the agreement to continue.', 'on'=>'register'),
array('verifyCode', 'captcha', 'allowEmpty'=>!extension_loaded('gd'), 'on'=>'register'),