ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

extending form_validation library

December 04, 2012 12:04am

Subscribe [1]
  • #1 / Dec 04, 2012 12:04am

    bhbutter123

    9 posts

    I am having trouble extending the form validation library. I placed the code in the system library file to see if it would work there and it is. When I move it to my library file it does not prevent the form from processing on failure of the function. my file is located under the correct folder and is named MY_Form_validation.php

    here is the code for the extended library:

    <?php
    class MY_Form_validation extends CI_Form_validation{
     public function currency($str){
      return (bool) preg_match('/(\-?)([0-9]+)(\.)([0-9]{2})/', $str);
     }
    }
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases