Yii User Module Adding New Field Mobile Number

Hello.

This might be an silly question to ask.

I tried so much to do this.

I installed yii User management module into my Yii app

from user/profileField/admin I created a new profile field for mobile number

Variable name - mobile

Title - Mobile

Field Type - VARCHAR

Field Size - 10

Field Size min - 10

Required - Yes, show on registration form

Match - ‘[0-9]’

Possition - 0

Visible - For All

by this new field is created for mobile number.

Now this is not going to validate to accept only numerical values for mobile number.

It also accepting characters.

How to validate this to only accept integers from 0 to 9??

what is missing or wrong in the code above??

Any help welcome…

thank you

U have condition in your match to check only one number in a string. Try this: ^[0-9]+$

thank for fast reply.

I tried Match as ^[0-9]+$

having error— preg_match() [<a href=‘function.preg-match’>function.preg-match</a>]: No ending delimiter ‘^’ found

what is wrong??

i am not getting this…

I solved that issue…

Only thing required is:-

just put an rule array in the $rules = array(); array which is empty by default. (In Profile Model)

as-

$rules = array(

array(‘mobile’, ‘numerical’,‘min’=>10, ‘integerOnly’=>true),

);

and removed the match expression for the mobile field.

and its working fine.

Thanks for the support…