Staring Valdiater ? How To Add

Hi All

I had in my form filed for username how to add type for it in model just to accept string ?

Like in int we can add :

numerical', 'integerOnly'=>true

Thanks in advance

Probably what you want to use is "match" … CRegularExpressionValidator.

Look at the reference.

And there are some comments that include usage samples.

Yes that is , Thank you my bro :)

array('username', 'match', 'pattern'=>'/^([a-z0-9_])+$/'),

This way also possible if you want to match types.

array('distance', 'type', 'type'=>'float', 'message'=>'should be a valid number.' )

Thanks Little Man :)