Tag Archives: model

How to use multiple validation rule sets per model in cakephp

As default we have single var $validate rule set in the model class which is triggered on each save() method call while saving form data. This is quite logical and sufficient for single form fields to validate but what if we have another form with somewhat different fields which we want to post and validate? As an answer i know of three different approaches. Continue reading

Multiple validation rules for a single field in cakephp

Cakephp framework provides a strong model validation mechanism. Here is the quick overview of multiple validation rules applied to a single field.

Let say we are using “User.password” and “User.password2” fields to accept/confirm password while registering to a site. We have “password2” field which is supposed to contain non-empty characters as well as the same password entered in the “password” field. Continue reading