Welcome Guest, Not a member yet? Register   Sign In
The problem when extend the form_validation system library
#6

[eluser]moriokasan[/eluser]
Just in case someone still needs this:

The error is generated by a bad naming in the file names and class names. This is in direct correlation with the prefix definition in 'config.php' file :
Code:
$config['subclass_prefix'] = 'MY_';

Considering that the prefix is 'MY_' then in application/libraries create a file named 'MY_Form_Validation.php' with content:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
* Created on Mar 24, 2012
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/

class MY_Form_validation extends CI_Form_validation
{
     function __construct($config = array())
     {
          parent::__construct($config);
     }

    function yourAdditionalFunction($someParam)
    {
        
    }
    
}
?>


Then in your controller use 'form_validation' as you would normally use:

Code:
$this->load->library('form_validation');
    
    $this->form_validation->set_rules('firstname', "username", "trim|required");
    $this->form_validation->set_rules('lastname', "password", "trim|required");
    
    //run your function
    $ret = $this->form_validation->yourAdditionalFunction('The Param');

Good luck!


Messages In This Thread
The problem when extend the form_validation system library - by El Forum - 03-25-2012, 06:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB