[eluser]Unknown[/eluser]
As the title suggests I am having an issue with the validation_errors() function. Here are the details I have:
I am autoloading the following: form_validation, form, url
Here is the code of one of the form controller functions I am using, but it happens with all instances in the system.
Code:
private function validate_item_form($type)
{
$this->form_validation->set_rules('headline', 'Headline', 'trim|required|xss_clean');
if($type == 'article')
{
$this->form_validation->set_rules('article', 'Article', 'trim|xss_clean');
}
$this->form_validation->set_rules('place', 'Location', 'trim|xss_clean');
$this->form_validation->set_rules('placeId', 'Place ID', 'trim|xss_clean');
$this->form_validation->set_rules('categoryId[]', 'Category', 'trim|xss_clean|callback_one_checkbox_set');
$this->form_validation->set_rules('tags', 'Tags', 'trim|xss_clean');
$this->form_validation->set_rules('resource[]', 'Links', 'trim|prep_url|xss_clean');
if($this->form_validation->run()) { return $this->input->post(); }
return false;
}
While in the controller or the view, if I call validation_errors() it returns an empty string. Now if I call $this->form_validation->error_string() from the controller, it returns the proper errors as long as it is called before validation_errors() or the view is loaded.
I went into the form_validation class and $_error_array returns properly, as long as $this->load->view and validation_errors() have not been called yet.
This issue is very frustrating because, as far as I can tell no one else is having this issue, and all of my other projects work just fine.
Also, I have updated all the core file and that didn't change anything.
If you need any other code sample or have quests, just let me know.