[eluser]Negligence[/eluser]
[quote author="adamp1" date="1204571599"]I don't know why you would have validation functions in the model? That's not what its for.[/quote]
I think you are misinformed. You probably think the concept of a Model is to
only connect to a database. In fact, the model's purpose is to manage any kind of data. Why would you validate a submission (to the database) in the Controller, when it's purpose is merely to direct traffic/load content?
It is perfectly logical to do validation within the model, because the validation concerns the data that is sent to the database. The work involved with creating, fetching, deleting, and validating of data should be all done within the model.
A very simple example using from the Controller:
Code:
class Controller
{
public function submit()
{
$this->load->model('Some_Model');
$errors = $this->Some_Model->validate($data);
$this->load->view('form' , $errors);
}