title: Extending form validation in Codeigniter
body: <p>I have placed this class file called 'My_Form_validation.php' into 'application/core' and I have also tried placing it in 'application/libraries'.</p>
  
  <p>In my controller I am using </p>
  
  <pre><code>$this-&gt;form_validation-&gt;set_rules('user_postcode', 'Postcode', 'valid_postcode|trim|required|xss_clean');
  </code></pre>
  
  <p>This is whats in My_Form_validation.php - the actual logic is not in question here because I have a couple of options to actually validate the postcode. What I need help with is understanding why it is not loading or getting called!</p>
  
  <p>My CI version is 
  define('CI_VERSION', '2.0.2');</p>
  
  <pre><code>&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  /**
   * Form validation for UK Postcodes
   * 
   * Check that its a valid postcode
   * @author James Mills &lt;james@koodoocreative.co.uk&gt;
   * @version 1.0
   * @package FriendsSavingMoney
   */
  
  class MY_Form_validation extends CI_Form_validation
  {
  
      function __construct()
      {
          parent::__construct();  
          log_message('debug', '*** Hello from MY_Form_validation ***');
      }
  
      function valid_postcode($postcode)
      {
  
          /**
           *
           * UK Postcode validation expression from Wikipedia
           * http://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom
           *
           * Note: Remember to strtoupper() your postcode before inserting into database!
           *
           */
  
          $pattern = "/^(GIR 0AA)|(((A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?[0-9]|((E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(SW|W)([2-9]|[1-9][0-9])|EC[1-9][0-9]) [0-9][ABD-HJLNP-UW-Z]{2})$/";
  
  
          if (preg_match($pattern, strtoupper($postcode)))
      {
              return TRUE;
          } 
          else
          {
              $this-&gt;set_message('valid_postcode', 'Please enter a valid postcode');
              return FALSE;
          }
      }
  }
  </code></pre>