Cannot execute MY_Form_validation - 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: Cannot execute MY_Form_validation (/showthread.php?tid=55313) |
Cannot execute MY_Form_validation - El Forum - 10-19-2012 [eluser]Adam_R[/eluser] What is wrong with this: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); I'm not able to get any validation from it base on called rules like Code: <?php Cannot execute MY_Form_validation - El Forum - 10-19-2012 [eluser]solid9[/eluser] How did you get this? Code: class MY_Form_validation extends CI_Form_validation { Isn't it like this, Code: class MY_Form_validation extends CI_Controller { What CI version you are using? also review your constructor. Cannot execute MY_Form_validation - El Forum - 10-19-2012 [eluser]CroNiX[/eluser] @solid9, the form validation library is NOT a controller... Cannot execute MY_Form_validation - El Forum - 10-19-2012 [eluser]CroNiX[/eluser] is your MY_Form_validation.php file in /application/libraries? Yes, for CI v2+, constructor should be: Code: function __construct() Cannot execute MY_Form_validation - El Forum - 10-19-2012 [eluser]CroNiX[/eluser] Also, none of your rules set an error message. Cannot execute MY_Form_validation - El Forum - 10-19-2012 [eluser]Aken[/eluser] If you're extending a library and don't need to use the constructor, then you don't need to define it again. ereg() is also a deprecated function. use preg_match() instead. Cannot execute MY_Form_validation - El Forum - 10-22-2012 [eluser]Adam_R[/eluser] So I have switched code to Code: function __construct() and changed ereg to preg_match but still it doesn't work. If I move for an example validation for valid_us_date to the forms.php controller it works. No clue why is not extending core form validation. Cannot execute MY_Form_validation - El Forum - 10-22-2012 [eluser]Adam_R[/eluser] OK, I have got this to work with that code: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |