Posts Tagged ‘model

Mar
22
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. Click to continue »

Tags : , , , , ,

Mar
21
How to apply search filters in cakephp ajax pagination

Sometimes we need to filter records via custom query while using ajax pagination in a cakephp application. An easy way to achieve this is to store query in a session varibale and to check it whenever an ajax call is made through “previous”, “next” or pagination links like 1,2,3 etc. Click to continue »

Tags : , , , , ,

Mar
20
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. Click to continue »

Tags : , , ,

Freelance Jobs