Tag Archives: Yii Validation

Username Validation In Yii Model

From my sourcecode, I gave the information for username validation in yii framework. <?php class User extends CActiveRecord { public static function model($className=__CLASS__) { return parent::model($className); } public function tableName() { return ‘tbl_user’; } public function rules() { array(‘username’, ‘match’, ‘pattern’ => ‘/^[A-Za-z0-9_]+$/u’, ‘message’=>’Username can contain only alphanumeric characters and hyphens(-).’), array(‘username’,’unique’), } } ?>

Insert, Update And Change Password In Yii Model

This tutorial will help you to understand “how to handle password field in yii”. I used scenario concept to change password. So the rule of models was configured based on scenario concept of yii framework.It was working fine for me. In Model.php Rules public function rules() { return array( array(‘username, password,confirmpassword’, ‘required’, ‘on’=>’insert’), array(‘username, password,confirmpassword’, […]