Hi guy,
I create custom class validate:
class AccountNumber extends CValidator
{
private $MIN_COUNT = 3;
private $MAX_COUNT = 10;
/**
* Validates a single attribute.
* This method should be overridden by child classes.
* @param CModel $object the data object being validated
* @param string $attribute the name of the attribute to be validated.
*/
public function validateAttribute($object, $attribute)
{
$this->addError($object,$attribute, 'Account Number is Invalid');
}
}
in extensions folder,
and in my model in rule function:
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('account_number', 'ext.AccountNumber'),
array('account_number', 'required'),
);
}
but in form error message not appear,
Could and bode help me???