Re: some phone validation rule problem

2010-08-05 Thread Dan Heberden
This was answered via email, but aparently google didn't get it in the
group so:

If the table is set to a numeric field (tinyint, smallint, int,
bigint) it will parse out the leading zero - the best would be a
varchar for how many characters you need. e.g. if you're storing your
numbers as 09+124-345-7890 then you want a varchar(15).

If you are storing completely numeric values and need leading zeros in
all cases, use sprintf:

$number = "91234567890";
$number = sprintf( "%12d", $number); // 091234567890

$number = "191234567890"; (already 12 digits long)
$number = sprintf( "%12d", $number); // 191234567890

On Aug 4, 7:51 am, hoss7  wrote:
> @dan thank you,but i have little problem,when i want save '09' in
> table i dont have
> '09' i have '9'
>
> if i want user phone number dont start with "09" what i am must to do?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: some phone validation rule problem

2010-08-04 Thread hoss7
@dan thank you,but i have little problem,when i want save '09' in
table i dont have
'09' i have '9'

if i want user phone number dont start with "09" what i am must to do?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: some phone validation rule problem

2010-08-04 Thread Dan Heberden
regex might be a better route:

'mobile' => array(
'rule' => '/^09/',
'message' => 'no
)


On Aug 4, 6:06 am, hoss7  wrote:
> if i want user phone number dont start with "09" what i am must to do?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: some phone validation rule problem

2010-08-04 Thread hoss7
if i want user phone number dont start with "09" what i am must to do?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


some phone validation rule problem

2010-08-04 Thread hoss7
my phone number start with "09"

'mobile'=>array(
'rule' => array('phone','09',null),
'message' => 'no'
)

my rule have error , what i am must to do for fix that?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en