Reputation: 4609
<?php
class MY_Form_validation extends CI_Form_validation {
function My_Form_validation()
{
parent::CI_Form_validation();
}
}
This is the code in the file MY_Form_validation.php that I have created in my CI libraries folder. There were some functions in there but i removed them to try and get to the bottom of this.
Utilizing this library extension, form validation simply does not work at all. I have all my form validation rules in a config file.
If i delete MY_Form_validation.php everything works perfectly.
A post on the CodeIgniter board yielded no results.
Perhaps someone here could help? Thanks
Upvotes: 1
Views: 5318
Reputation: 1556
As I'm using CI 3 Form validation, the following is working for me.
class MY_Form_validation extends CI_Form_validation {
public function __construct( $rules = array() )
{
parent::__construct($rules);
}
//other validation functions...
}
Happy Coding
Upvotes: 0
Reputation: 2802
Make file name in your application/library directory: MY_Form_validation.php
then in your class
Code:
class MY_Form_validation extends CI_Form_validation
{
function My_Form_validation()
{
parent::CI_Form_validation();
}
}
Upvotes: 1
Reputation: 639
In case you've upgraded to CodeIgniter 2.0.x or later make sure that you change the above code to:
class MY_Form_validation extends CI_Form_validation {
function MY_Form_validation( $config = array() )
{
parent::__construct($config);
}
Notice the change from:
parent::CI_Form_validation($config);
To:
parent::__construct($config);
Definitely caused me a problem for a bit!
Upvotes: 3
Reputation: 566
Try this instead. You need to pass the $config array from the extended class to the CI_Form_validation. Also make sure the spelling is correct and case sensitive.
class MY_Form_validation extends CI_Form_validation {
function MY_Form_validation( $config = array() )
{
parent::CI_Form_validation($config);
}
Upvotes: 5