On Wed, Feb 4, 2009 at 7:02 AM, grigri <j...@hendersonwebdesign.com> wrote: > > Something like this should work: > > (code not tested, but theory sound) > > class Customer extends AppModel { > var $validate = array( > 'country_id' => array( > array( > 'rule' => array('custom', '/^[a-z]{2}$/'), > 'required' => true, > 'message' => 'Please select the country that you reside in.' > ), > array( > 'rule' => array('checkCountry'), > 'message' => Please stop playing with firebug.' > ), > ) > ); > > function checkCountry($data) { > $countryCode = reset($data); > return $this->Country->hasAny(array('Country.code' => > $countryCode)); > } > } > > hth > grigri
That's much more sound. And thanks for the laugh. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---