[eluser]Pnux[/eluser]
Im having a lot of trouble trying to figure out why form_validation->run() returns a bool. If it returned an object instead (like the database library) there could be several validations in the same page (im speculating a little on this one, didnt try this yet), keep track of the errors without needing a helper and many other goodies.
Im thinking something like:
Code:
$validation = $this->form_validation->init('foo');
$validation->set_rule('someField','required');
$result = $validation->run();
if ($result === FALSE) {
$errors = $validation->error_array;
echo json_encode(array_merge(array('success'=>false),array('error'=>$errors)));
}
else {
// do something with the data
}
Im planing on updating this post with more reasons why i think it should return an object instead of a bool, or at least be able to use it as an object. I havent started coding what i need form validation for, so all i have is a somewhat vague idea of why object is better.