Hi there,

This might not be a cakePHP issue, but here goes...

I use CakePHP + WAMP on Windows.
My problem is that whenever there is a dash in a pattern and an input
string has a dash, no match occurs.
As a result, validation fails (like the built in e-mail and phone
number validations).

I have tried using a custom validation method with the following
code:

function valid_phone($data) {
  $pattern = "^[0-9]{3}-[0-9]{4}$";
  $phone_no = trim($data['phone']);
  if (ereg($pattern, $phone_no))
        return 1;
  else
        return 0;
}

If I remove the dash from the pattern and input 7 digits, everything
works fine.
If I add the dash and input something like "123-45657", validation
fails.

This is not the only pattern I've tried, all with the same results.

Any ideas?

Thank you!

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to