Create your own Validation Rule

Comparing #6 with #7

Revision #7 was created by Boaz Boaz on May 14, 2012, 12:41:35 PM.

actually, not :) (undoing my last update), as its not in line with parent abstract declaration for this method (which is a bug IMHO, I'll report to the Yii team)

Content

[...]
* Validates the attribute of the object.
* If there is any error, the error message is added to the object.
* @param CModel $object the object being validated
* @param string $attribute the attribute being validated
*/
protected function validateAttribute(
CModel $object,$attribute)
{
// check the strength parameter used in the validation rule of our model
if ($this->strength == 'weak')
$pattern = $this->weak_pattern;
elseif ($this->strength == 'strong')
[...]