Re: validate alphanumeric
It seems somehow the root of the problem is I try to override the built-in alpaNumeric function. Still no idea how to solve it --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validate alphanumeric
Still I get the same error message. At /cake/libs/validation.php line 830 if (preg_match($_this->regex, $_this->check)) { I have an array in $_this->check and this is what generates the error. In my model I use the following validation rule: var $validate = array( 'nev' => array('rule' => 'alphaNumeric') ); By this in validation.php at line 830 I have array('nev' => 'theGivenString') at this makes the problem, but I can not find out how to solve it. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validate alphanumeric
it was fixed in https://trac.cakephp.org/ticket/5025, have same problem with my lithuanian chars. On Sep 26, 7:50 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hari, > > I would like to use validation with 1.2. I need something like > alpanumeric, but it seems it does not accept non latin characters. I > need it for a hungarian site, so I use utf-8. I searched the net, but > did not find any useful information how to use validation with > multibyte characters. > > Any suggestion? > > rrd --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validate alphanumeric
add a new method in app_model (if you will use that validation in more than one model) or in the model itself with the appropriate regex. i have never played with hungarian chars or anything else than latin actually, so I can't help more but that should get you on the right track. cheers JadB http://loudbaking.myeasyscripts.com On Sep 26, 12:50 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hari, > > I would like to use validation with 1.2. I need something like > alpanumeric, but it seems it does not accept non latin characters. I > need it for a hungarian site, so I use utf-8. I searched the net, but > did not find any useful information how to use validation with > multibyte characters. > > Any suggestion? > > rrd --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validate alphanumeric
You can write validation function by yourself. On Sat, Sep 27, 2008 at 12:50 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hari, > > I would like to use validation with 1.2. I need something like > alpanumeric, but it seems it does not accept non latin characters. I > need it for a hungarian site, so I use utf-8. I searched the net, but > did not find any useful information how to use validation with > multibyte characters. > > Any suggestion? > > rrd > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
validate alphanumeric
Hari, I would like to use validation with 1.2. I need something like alpanumeric, but it seems it does not accept non latin characters. I need it for a hungarian site, so I use utf-8. I searched the net, but did not find any useful information how to use validation with multibyte characters. Any suggestion? rrd --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Validate alphaNumeric with spaces
That's actually the exact code I have in my own model validation, and it works perfectly for alphanumeric with spaces. On Jan 23, 2008 3:16 AM, Marcin Jaworski <[EMAIL PROTECTED]> wrote: > > This should do it > 'rule' => array('custom', '/^[a-z0-9 ]*$/i') > > On 23 Sty, 03:52, Chris Gallop <[EMAIL PROTECTED]> wrote: > > I am trying to validate a field and I want to use alphaNumeric form of > > validation with spaces possible. However the alphaNumeric does not > > seem to allow spaces. Is there a validation rule I can tack on to > > allow this. > > > > My code is below and I would like the state field to be allowed to > > have spaces and be left blank. > > > > var $validate = array( > > 'firstname' => array('rule' => 'alphaNumeric', 'message' > =>'Valid > > characters: letters and numbers only'), > > 'lastname' => array('rule' => 'alphaNumeric', 'message' > > =>'Valid characters: letters and numbers only. Cannot be blank.'), > > 'email' => array('rule' => array('_isUnique', 'email'), 'rule' > > => 'email', 'message' =>'E-mail must be a valid and unqiue e-mail > > address'), > > 'suburb' => array('rule' => 'alphaNumeric', 'message' => > 'Suburb > > contain only letters, including area code'), > > 'state' => array('rule' => 'alphaNumeric', 'message' => > 'Suburb > > contain only letters, including area code'), > > 'postcode' => array('rule' => 'alphaNumeric', 'message' > => 'Suburb > > contain only letters, including area code') > > ); > > > > Any tips appreciated. > > > -- In the name of Life, Liberty, and the pursuit of my sanity. Siebren Bakker(Aevum Decessus) -BEGIN GEEK CODE BLOCK- Version: 3.12 GCS d- s+: a19 C UL++ P L++ !E W++ N(-) o? K? w(+) O? M-- V? PS+ PE Y- PGP- t+ 5? X- R tv-- b++ Di D+ G+ e h! r y- --END GEEK CODE BLOCK-- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Validate alphaNumeric with spaces
This should do it 'rule' => array('custom', '/^[a-z0-9 ]*$/i') On 23 Sty, 03:52, Chris Gallop <[EMAIL PROTECTED]> wrote: > I am trying to validate a field and I want to use alphaNumeric form of > validation with spaces possible. However the alphaNumeric does not > seem to allow spaces. Is there a validation rule I can tack on to > allow this. > > My code is below and I would like the state field to be allowed to > have spaces and be left blank. > > var $validate = array( > 'firstname' => array('rule' => 'alphaNumeric', 'message' > =>'Valid > characters: letters and numbers only'), > 'lastname' => array('rule' => 'alphaNumeric', 'message' > =>'Valid characters: letters and numbers only. Cannot be blank.'), > 'email' => array('rule' => array('_isUnique', 'email'), 'rule' > => 'email', 'message' =>'E-mail must be a valid and unqiue e-mail > address'), > 'suburb' => array('rule' => 'alphaNumeric', 'message' => > 'Suburb > contain only letters, including area code'), > 'state' => array('rule' => 'alphaNumeric', 'message' => > 'Suburb > contain only letters, including area code'), > 'postcode' => array('rule' => 'alphaNumeric', 'message' => > 'Suburb > contain only letters, including area code') > ); > > Any tips appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Validate alphaNumeric with spaces
I am trying to validate a field and I want to use alphaNumeric form of validation with spaces possible. However the alphaNumeric does not seem to allow spaces. Is there a validation rule I can tack on to allow this. My code is below and I would like the state field to be allowed to have spaces and be left blank. var $validate = array( 'firstname' => array('rule' => 'alphaNumeric', 'message' =>'Valid characters: letters and numbers only'), 'lastname' => array('rule' => 'alphaNumeric', 'message' =>'Valid characters: letters and numbers only. Cannot be blank.'), 'email' => array('rule' => array('_isUnique', 'email'), 'rule' => 'email', 'message' =>'E-mail must be a valid and unqiue e-mail address'), 'suburb' => array('rule' => 'alphaNumeric', 'message' => 'Suburb contain only letters, including area code'), 'state' => array('rule' => 'alphaNumeric', 'message' => 'Suburb contain only letters, including area code'), 'postcode' => array('rule' => 'alphaNumeric', 'message' => 'Suburb contain only letters, including area code') ); Any tips appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---