[eluser]Maxximus[/eluser]
When I try to use validation in a module, the behaviour between 4.0.29 and 4.0.30 seems to have changed. The module is called by a method in another module. Had to autoload Validation in 4.0.30, before it was possible in the module itself.
Validation output is not correct either, using $this->validate->field gives unexpected results (0 values).
What I use is this:
Code:
in /application/modules/amoduleclass/controllers/amoduleclass.php
class Amoduleclass extends Module {
function __construct() {
parent::Module();
$this->load->model('m_search', 'search');
}
function ...
}
in /application/modules/amoduleclass/methods/mymethod.php:
class Mymethod extends Amoduleclass {
function __construct() { // <== empty, tried several different options.
}
...
function somefunction() {
echo modules::run('anotherfunction', $this->uri->rsegment(6), 'aForm');
}
function _output($output) { // <== tried with and without this function
echo $output;
}
}
in /application/modules/othermoduleclass/controllers/othermoduleclass.php
class Othermoduleclass extends Module {
function __construct() {
parent::Module();
$this->load->model('m_modelx', 'modelx');
$this->load->library('validation'); //<=== Will error, needs to be autoloaded
}
function aForm($input) {
$rules['email'] = "trim|required|valid_email";
$this->validation->set_rules($rules); // <== Will error
}
}
Did not try all this with the new 4.1.x branch, some other issues there at this moment.
Anyone have an idea where I go wrong?