My_Form_validation class not loading - 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: My_Form_validation class not loading (/showthread.php?tid=48777) |
My_Form_validation class not loading - El Forum - 01-28-2012 [eluser]ChrisHJ[/eluser] Hi, I'm trying to use a custom validation class with custom validation rules, but for some reason the class never loads. The set-up is very simple, so I'm just gonna give it all to you here, starting with my function (in controller 'Bruger') when the button is clicked: Code: public function glemt_adgangskode() This should bring us to the auth library, in the function forgot_password($user_email): Code: public function forgot_password($user_email) I have no problem with the build-in rules ('required' works), but my custom rule 'tester_valid' does not. My test is very simple: Code: class My_Form_validation extends CI_Form_validation { The function is empty for now. Like I said, the class is never found by CI, as proved by log: Code: DEBUG - 2012-01-28 16:42:13 --> Config Class Initialized Im using CI 2.1.0, and in the previous version of ci there was no problem.. The really weird part is that other classes with 'MY_' prefix loads just fine, and I can't for the world figure why this particular one doesn't. Please help me! My_Form_validation class not loading - El Forum - 01-28-2012 [eluser]Jan_1[/eluser] It is looking for a function in the same controller. So, you might just put it there..? Link to User_Guide My_Form_validation class not loading - El Forum - 01-28-2012 [eluser]ChrisHJ[/eluser] Hi, in the controller its calling $this->auth->forgot_password which is a function in the library auth or am I missing something ? My_Form_validation class not loading - El Forum - 01-28-2012 [eluser]Jan_1[/eluser] and "public function tester_valid($var)" is in the same file like "public function forgot_password($user_email)" ? My_Form_validation class not loading - El Forum - 01-28-2012 [eluser]ChrisHJ[/eluser] No no. The function 'tester_valid($var)' is placed in the class 'My_Form_validation'. The problem really is that the class 'My_Form_validation' isn't loading. Thanks for looking into this! My_Form_validation class not loading - El Forum - 01-28-2012 [eluser]Jan_1[/eluser] I don't really understand, where you have that class (in the lib?), so I can't say something about that. But, if you do write Code: $this->ci->form_validation->set_rules('user_email', 'Email', 'required|tester_valid'); If you but it there - the function will work. My_Form_validation class not loading - El Forum - 01-28-2012 [eluser]InsiteFX[/eluser] Because you have My_ and it should be MY_ !!! Code: class MY_Form_validation extends CI_Form_validation { This library should be placed in application/libraries/MY_Form_validation.php My_Form_validation class not loading - El Forum - 01-29-2012 [eluser]ChrisHJ[/eluser] Jesus christ, some times you just look so much that u dont see the obvious.. Thanks :-) |