extending CI_form_validation don't work |
[eluser]Unknown[/eluser]
So i extended my form_validation library. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); but when i try to reach it, i get error: Code: Fatal error: Call to undefined method CI_Form_validation::clear_field_data() I trying to call like that Code: $this->form_validation->clear_field_data(); What i am doing wrong?
[eluser]TheFuzzy0ne[/eluser]
If you want to extend the form validation class, you need to call your file MY_Form_validation.php, and the class name should be MY_Form_validation. You can do it your way too, but you'll need to do it like this: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Then you'd need to load your library like this: Code: $this->load->library('lt_form_validation'); And then call the methods like this: Code: $this->lt_form_validation->clear_field_data();
[eluser]CroNiX[/eluser]
/application/libraries/MY_Form_validation.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Code: $this->load->library('form_validation'); //loads form validation and extends it with MY_form_validation automatically. See the Extending Native Libraries section for more info. |
Welcome Guest, Not a member yet? Register Sign In |