News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jonathan Snook's Blog:
Multiple Validation Sets in CakePHP 1.2
July 23, 2008 @ 07:51:27

Jonathan Snook has posted two methods for creating multiple validation sets in the latest version of your CakePHP application.

In CakePHP, you define how your data should be validated by setting parameters on the validate property of your model. In version 1.2, there is an on option that can be set on a specific rule that, when set, is either create or update. [...] Despite that, I developed a slightly different approach that allows for different validation sets to be specified and to be cleanly separated from each other.

He overrides the validates() method with his own in a custom model in one of two ways - having the script check for a validation set for the current controller or by specifying it directly with a validationSet property. Code for both methods is included.

0 comments voice your opinion now!
cakephp framework validation set detect controller property define tutorial


blog comments powered by Disqus

Similar Posts

JSLabs Blog: How to write an image gallery script in PHP

Chris Hartjes's Blog: CakePHP Pagination With A HABTM Relationship

Ivan Iordanov's Blog: extending Zend_Db_Table to create NestedSet models

DevShed: Using PDO Objects in PHP 5 - Using the PDO extension

DevShed: Setting up the Foundation for an Extensible Website Engine with PHP 5


Community Events





Don't see your event here?
Let us know!


interview series community framework zendserver laravel threedevsandamaybe opinion api library deployment podcast language symfony release developer introduction list bugfix tips

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework