extending CI_form_validation don't work - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: extending CI_form_validation don't work (/showthread.php?tid=57536) |
extending CI_form_validation don't work - El Forum - 03-21-2013 [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? extending CI_form_validation don't work - El Forum - 03-21-2013 [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(); extending CI_form_validation don't work - El Forum - 03-21-2013 [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. |