[eluser]xavieremerson[/eluser]
hi...
I'm very new to CI. I'm extended CI_Form_validation to my_validation.. but after that i called that function in another my library by callback... But it is not working... Any one could help me... Please patience with me...
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class control extends Controller
{
function control()
{
parent::Controller();
$this->load->library("MY_User_manage");
}
function register()
{
$this->my_user_manage->register();
}
....................
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_User_manage
{
function MY_User_manage()
{
$this->CI = &get;_instance();
$this->CI->load->library('form_validation');
$this->CI->load->library('validation');
$this->CI->load->library('my_validation');
$this->CI->load->model('user_model');
}
function register()
{
$this->CI->form_validation->set_rules('username', 'Name', 'trim|required|max_length[15]|name_check');
$this->CI->form_validation->set_rules('email','Email','trim|required|callback_email_check|valid_email|email_available');
$this->CI->form_validation->set_rules('password','Password','trim|required|min_length[6]|max_length[12]|matches[confirm_password]');
if ($this->CI->form_validation->run() == FALSE)
{
.......
...
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Validation extends CI_Form_validation
{
function MY_Form_Validation()
{
parent::CI_Form_Validation();
// Get CI Instance
$this->CI = &get;_instance();
}
function email_check($str)
{
if (!strcasecmp($str,'Email Id'))
{
$this->CI->validation->set_message('email_check', 'The %s field is required');
return FALSE;
}
else
{
return TRUE;
}
}
Thankz in advance
please reply me to
xavier