I set up the validation rule in my model, but when it comes to creating the form field it states undefined attribute etc. I thought I could fix this by defining the attribute in the model but it still does not work.
Does anyone have an example of how to use this, model as well as view.
<?php
class User extends CActiveRecord {
public $email_confirmation;
public $password_confirmation;
public static function model($className=__CLASS__) {
return parent::model($className);
}
public function rules() {
return array(
array("email, first_name, last_name, password", "required"),
array("email", "compare", "compareAttribute" => "email_confirmation"),
array("password", "compare", "compareAttribute" => "password_confirmation")
);
}
}
?>
What happens is, is that the error shows up "Email must be repeated exactly.", However it always states this even if the two email fields are exactly correct. Almost like it generates the error no matter what.