validationrules - Yii rules() match failing -


i've had working registration/update model, wanted expand on models added in regex password field. have checked regex works online , client side validation shows works, model refuses save now. i'm not sure why, me out please?

        return array(         array('firstname, lastname, email, password', 'required'),         array('firstname', 'length', 'max'=>45),         array('lastname', 'length', 'max'=>80),         array('email', 'length', 'max'=>120),         // email must valid email         array('email', 'email'),             // email must unique         array('email', 'unique'),         // regex password         array('password','match', 'pattern'=>'/^[a-z0-9_-]{7,20}$/i',              'message'=>'the password must between 7 , 20 characters              long'),           array('password', 'length', 'min'=>7, 'max'=>64),         array('date_modified', 'safe'),         array('active, date_modified', 'default', 'setonempty' => true, 'value' => null),         array('id, first_name, last_name, email, pass, active, date_created, date_modified, live', 'safe', 'on'=>'search'),      ); 

thanks

jonny

you can create own validation rule.

http://www.yiiframework.com/wiki/168/create-your-own-validation-rule/

or else can define validation rule in yii model, this:

return array(     array('password', 'length', 'min'=>7, 'max'=>64),     array('password','pattern'=>'/^[a-za-z0-9_!@#$%^&*()+=?.,]+$/u', 'message'=>'spaces or given characters not allowed'), ); 

there more validation can specify in model.


Comments