Difference between #3 and #4 of
Create your own Validation Rule

Revision #4 has been created by Orteko on Apr 18, 2011, 6:10:20 AM with the memo:

fix typos
« previous (#3) next (#5) »

Changes

Title unchanged

Create your own Validation Rule

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

validator, validation rules, model validation, create validator

Content changed

[...]
```php
/**
* check if the user password is strong enough
* check the password against the pattern requested
* by the streng
hth parameter
* This is the 'passwordStrength' validator as declared in rules().
*/
[...]
In our rules method we used this rule on the password attribute, so the value of attribute inside our validation model will be **password**

In the rule we also setted an additional parameter named **streng
hth**
the value of that parameter will be inside the $params array

As you can see inside the method we are making a call to [CModel::addError()](http://www.yiiframework.com/doc/api/1.1/CModel#addError-detail).
Add Error accepts two parameters: the first one is the name of the attribute that you want to display the error in your form, the second one is the actual error string you want to be displayed.
[...]
58 0
54 followers
Viewed: 212 607 times
Version: 1.1
Category: How-tos
Written by: nickcv
Last updated by: Gismo
Created on: Mar 31, 2011
Last updated: 5 years ago
Update Article

Revisions

View all history