[eluser]louis w[/eluser]
I have this code:
Code:
$itemfields = $this->input->post('itemfields');
// ...
$this->load->library('validation');
$rules = array('sButton' => 'required');
$this->validation->set_rules($rules);
$this->validation->set_fields($itemfields);
if ($this->validation->run() == FALSE)
echo $this->validation->error_string;
My $itemfields array print_r's as this:
Code:
Array
(
[sButton] => sfsdfsdafasdfasdf
)
When I run validation I get this error:
The sfsdfsdafasdfasdf field must have a value.
What is going on? Why is it using the value of the field instead of it's name?
Furthermore, I tried setting a custom error message just for this field like this:
$this->validation->set_message('sButton', 'CUSTOM MESSAGE!!!');
And it didn't do anything.