Custom validation example in Codeigniter

This tutorial shows how to work with custom validation in Codeigniter. We need many times that a field has to be validated against some type of values but built-in features do not provide all kind of validation pattern, so we need to write a function which will be used as callback function for a particuler input field for validation purpose. The below example validates the date field and if the date is invalid then it displays an appropriate error message to the user.
View part: application/views/date.php

 

Controller part:

Usage Example

 

That’s all. Thanks for your reading. Please do not forget to leave a comment.

Soumitra

Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.