[eluser]jcjc[/eluser]
I'm trying to set a custom error message for a function that checks whether user input field matches a record from the database.
the query runs fine and returns a valid/invalid result.
I'm trying to set a custom error message and it doesn't seem to be working.
the input field is:
Code:
$this->form_validation->set_rules('registerCode', 'Reg Code', 'trim|required|callback__checkRegCode');
My query to check regCode is:
Code:
if(!$checkRegCode = $this->userModel->_checkRegCode())
{
echo "invalid code";
$this->form_validation->set_message('_checkRegCode', 'Reg Code invalid');
}
I get a blank screen - form_validation is autoloaded as well as xss_filtering is set to true in config.
function to check for regCode is:
Code:
function _checkRegCode()
{
$regCodeInput = $this->input->post('registerCode');
$this->db->select('RegCode');
$this->db->where('RegCode', $regCodeInput);
$checkRegCode = $this->db->get('RegCode');
if($checkRegCode->num_rows == 1)
{
return $checkRegCode;
}
}
thanks