Monday, September 29, 2008

Re: validate alphanumeric

The manual says I could overdefined any built-in validate rule.

So I added alphaNumeric function to the app_model.php

function alphaNumeric($check){
//alphaNumeric felüldefiniálása a magyar ékezetek kezelése érdekénben
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;

if (is_array($check)) {
$_this->_extract($check);
}

if (empty($_this->check) && $_this->check != '0') {
return false;
}

$_this->regex = '/[^\\dA-ZÍÖÜÓŐÚÉÁŰ ]/i';
if ($_this->_check() === true) {
return false;
} else {
return true;
}
}

This is the method from validation.php, I just changed the regex. But
I get an error message
Warning (2): preg_match() expects parameter 2 to be string, array
given [CORE/cake/libs/validation.php, line 830]

I am a little bit confused.

Any idea?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: