[eluser]Unknown[/eluser]
Hi, I need help with this, i dunno why the callback not being called.
Code:
class C_registro extends Controller {
function C_registro()
{
parent::Controller();
$this->load->helper(array('url','form'));
$this->load->library('form_validation');
$this->load->database();
$this->load->model('m_user');
}
function index()
{
$this->registrar();
}
//-------------------------------------------------------------------------------------------------
function mostrarRegistro()
{
$datos = array(
'titulo' => "Registro de Usuario",
'url' => $this->config->item('path_url'),
'jquery' => $this->config->item('path_jquery'),
'jquery_ui' => $this->config->item('path_jquery_ui'),
'ui_css' => $this->config->item('path_jquery_ui_css')
);
$this->load->view('v_registro',$datos);
}
//-------------------------------------------------------------------------------------------------
function registrar()
{
$this->form_validation->set_rules('nombre','Usuario','trim|required|min_length[3]|max_length[50]|callback_username_check');
$this->form_validation->set_rules('pass' ,'ContraseƱa','trim|required|min_length[8]|max_length[50]|alpha_numeric|MD5');
$this->form_validation->set_error_delimiters('<div class="ui-state-error ui-corner-all" align="center">', '</div>');
if($this->form_validation->run() == FALSE)
{
$this->mostrarRegistro();
}
else
{
redirect('ok');
}
}
}
//-------------------------------------------------------------------------------------------------
function username_check($usr)
{
$this->form_validation->set_message('username_check', 'The callback was called.');
return FALSE;
/*
$existe = $this->m_user->existeUser($usr);
if ($existe)
{
$this->form_validation->set_message('username_check', 'El usuario ya existe');
$rtrn = FALSE;
}
else
{
$this->m_user->altaUser($usr,$this->input->post('pass'));
$rtrn = TRUE;
}
return $rtrn;
*/
}
//--------------------------------------------------------------------------------