[eluser]kirkaracha[/eluser]
I have a callback that isn't working.
From the rules array:
Code:
array(
'field' => 'state_id',
'label' => 'state',
'rules' => 'trim|required|numeric'
),
array(
'field' => 'district_number',
'label' => 'district number',
'rules' => 'trim|required|numeric|callback__check_dupe_district'
),
The callback:
Code:
public function _check_dupe_district(){
$query = $this->db->get_where('congress_districts',array('state_id' => $this->input->post('state_id'),'district_number' => $this->input->post('district_number')),0,0);
if ($query->num_rows() > 0) {
$this->set_message('_check_dupe_district','This district is already listed.');
return FALSE;
} else {
return TRUE;
}
} // _check_dupe_district
I'm expecting it to display an error when I submit a form with a state_id and district_number that area already listed, but it doesn't. (I know they're already being used because I'm looking at the database.) What am I missing?