I can’t figure out where I’ve gone wrong. I am getting the following error:
Licensee has an invalid validation rule. The rule must specify attributes to be validated and the validator name.
My LicenseeForm model has the following code that is being executed:
class LicenseeForm extends CFormModel
{
public $email;
public $password;
public $url;
public $verifyCode;
public function rules()
{
return array(
array('email, password, url', 'required'),
array('email', 'email'),
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
);
}
public function addLicensee()
{
$licensee=new Licensee;
$licensee->url = $this->url;
$licensee->email = $this->email;
$licensee->password = $this->password;
$licensee->status = 0;
$licensee->background = 'ffffff';
$licensee->width = '950';
$licensee->searchFont = '000000';
$licensee->topicFont = 'ffffff';
$licensee->topicBackground = '4c99c5';
$licensee->topicBorder = '13487c';
$licensee->signupDate = date('Y-m-d H:i:s');
$licensee->save();
}
My understanding is that when you call the save() function the validation rules are triggered. The rules I’ve set up are fairly standard - check for empty values, email validation, and a captcha. Why am I receiving this error?