Form Validation Callbacks in HMVC in Codeigniter

Many of us are using the HMVC extension (Hierarchical Model View Controller) in codeigniter which is available.

HMVC helps developing modular apps in a very convenient way. All the things work simply fine just like a clean CI installation. There’re 1 or two exceptions which i have found. One is the callback of Form_validation class. If we are making some forms like registration we check emails and usernames and we do it in the form validation class using callbacks. If we look at the basic callback structure when validating forms from CI documentation, it appears like.


But this callback will not simply work. Some of my precious hours went why it was not working. Then i navigated the Form_validation.php in /system/libraries folder around line 580 which looks like


The function – method_exists returns false even if the callback function is there in the Controller and after all in the CI loader object. So it came out from the forum that you have to do a little extension to Form Validation class which is


And when running the validation like in earlier code

you have to provide an addition $this as a parameter to run method. which will look like

Now, your validation callbacks will work perfectly.

Another note, if you’re trying to access a public variable of a controller via the get_instance() in hooks , you’ll have to write in your controller like this.

CI::instance()->var_name = “Some Value”;

May be there are some other required adjustments when using HMVC, but i came across this two time killing adjustments.

Partners Section:

depfile password Depfile Premium Account Depfile Premium Depfile Premium Account Depfile Premium Depfile Premium Account Depfile Premium Account dep file Dep file dep file dep file dep file dep file Depfile Premium Account Depfile Premium yify torrent empire torrent yify vikings season 4 auto clicker autoclicker slender the eight pages he gift torrent walking dead torrent the walking dead torrent fl studio 12 torrent