You could use validation and create a custom method to validate to your specification.
http://book.cakephp.org/2.0/en/models/data-validation.html#custom-validation-rules On Friday, 22 November 2013 18:43:34 UTC-5, advantage+ wrote: > > What is the best way when saving data for example take city or first name > field. > > You want it to only be a-z and a space - or.(period) > > > > Should you in beforeValidate do a preg_replace and remove anything that > you do not want then save(attempt) it or simply use the validation rules to > check and save / return false explaining why? > > > > Just curious as to how people approach this and reasons for doing it > either way. > > > > Thanks, > > Dave > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
