Welcome Guest, Not a member yet? Register   Sign In
Please Help with Form Validation Hmvc
#4

(This post was last modified: 10-08-2015, 09:22 PM by wolfgang1983.)

Make sure that this code below is in application/libraries/MY_Form_validation.php


PHP Code:
<?php

class MY_Form_validation extends CI_Form_validation {

    function 
run($module ''$group '') {
        (
is_object($module)) AND $this->CI = &$module;
        return 
parent::run($group);
    }

  


Second when using callbacks with HMVC must include $this variable as shown below.


PHP Code:
public function index() {

$this->load->library('form_validation');

$this->form_validation->set_rules('something''Something''required|callback_test');

// Must include $this variable 

if ($this->form_validation->run($this) == FALSE) {

} else {

}

}

public function 
test() {

$this->load->library('form_validation');

if (
$this->model_something->can_loggin() == TRUE) {

return 
TRUE;

} else {

$this->form_validation->set_message('test''Cannot Login');

return 
FALSE;

}


There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
Please Help with Form Validation Hmvc - by Vimal - 09-18-2015, 04:04 AM
RE: Please Help with Form Validation Hmvc - by wolfgang1983 - 10-08-2015, 09:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB