Welcome Guest, Not a member yet? Register   Sign In
Form Validation > Extend CI Base
#1

[eluser]Multisnet[/eluser]
When I tried to extend the Form Validation CI base class I faced a problem that I would like to share with you. Perhaps this could be useful to someone, I lost a few hours trying to solve it.


Extending Form_validation CI base class in the usual way won’t work with the rules in a config file.So we need to do this:

Code:
function MO_Form_validation($rules = array())
{
parent::CI_Form_validation($rules);
}

I've discussed this topic in another post

UPDATED!!
#2

[eluser]heat23[/eluser]
I've also spent several hours trying to extend the CI_Form_validation class without any luck!! I don't want to crash your thread, so I'll post my details in a new one
#3

[eluser]stevezissou[/eluser]
Just glanced at your code, but it seems as if you are calling the wrong parent constructor. If you are trying to extend the class 'CI_Form_validation' it would be...

Code:
class MO_Form_validation extends CI_Form_validation {

  function MO_Form_validation( $rules = array() ) {

    parent::CI_Form_validation( $rules );

  }

}
#4

[eluser]Multisnet[/eluser]
Sorry, I did it like you said but I wrote the code wrong here Wink Thanks anyway, I'm going to update it.




Theme © iAndrew 2016 - Forum software by © MyBB