![]() |
Need help extending the CI_Form_validation class - 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: Need help extending the CI_Form_validation class (/showthread.php?tid=20015) |
Need help extending the CI_Form_validation class - El Forum - 06-25-2009 [eluser]heat23[/eluser] I've spent several hours trying to get this working many CI Forum/ Google searches later, here I am... Here is what I did so far, please let me know what I am doing wrong. By the way, I am using PHP 4 and CI 1.7.1 1) I created the file MY_Form_validation.php in the /application/libraries folder 2) Inside this file, I have: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 3) In my controler which contains the form, I have: Code: $this->load->library(array('form_validation')); 4) When I submit the form, I get the error Code: Fatal error: Call to undefined method: my_form_validation->set_fields() in C:\www\ci\system\application\controllers\c_eval.php on line 74 $this->form_validation->set_fields($fields); Can someone tell me what I am doing wrong here? Need help extending the CI_Form_validation class - El Forum - 06-25-2009 [eluser]lifo101[/eluser] I believe set_fields() is part of the old Validation class and does not exist in the newer Form_Validation class. Need help extending the CI_Form_validation class - El Forum - 06-25-2009 [eluser]Pascal Kriete[/eluser] You're mixing up the old and new validation libraries. The new one (form_validation) doesn't use set fields. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); And the controller: Code: $this->form_validation->set_rules('type', 'Type', 'required|type_check'; Need help extending the CI_Form_validation class - El Forum - 06-25-2009 [eluser]heat23[/eluser] Thanks Pascal, that did the trick!! |