Wednesday, January 28, 2009

Re: isUnique case-sensitivity off ??

override isUnique in your model and use something strtolower() when
searching for a given field or comparing the value.

On Jan 29, 1:52 am, forrestgump <vikhya...@gmail.com> wrote:
> Hey guys,
>   Need help with this...
> i have validation rules defined as thus:
> var $validate = array(
>                         'city' => array(
>                                                 'notempty'=>array(
>                                             'rule' => 'alphaNumeric',
>                                             'message' => 'Error: Empty City Field',
>                                             'allowEmpty' => false
>                                                         ),
>                                                 'unique'=>array(
>                                             'rule' => 'isUnique',
>                                             'message' => 'Error: City Already Exists',
>                                                         )
>                                                 )
>                              );
>
> they work well, but i noticed that the isUnique rule is case-sensitive
> ie i can have 2 entries like so:
> "Newyork" and alse "newyork". I was wondering if there is any way to
> turn off the case-sensitivity
--~--~---------~--~----~------------~-------~--~----~
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: