CodeIgniter Forums
Validation errors - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Validation errors (/showthread.php?tid=66393)



Validation errors - RBX - 10-18-2016

Why doesn't this throw any error, and always silently fails? Why is the third parameter optional?

PHP Code:
$this->form_validation->set_rules('field_name''some_rule|another_rule');
if(
$this->form_validation->run()) {
 
 //never executes
} else {
 
 //no errors generated
 
 echo validation_errors();




RE: Routing changes at a single location - InsiteFX - 10-18-2016

PHP Code:
if ($this->form_validation->run() == FALSE



RE: Validation errors - dave friend - 10-19-2016

form_validation->set_rules takes three arguments - field name, field label, rules.  Documentation here

Looks like you are only providing two arguments.

Try this

PHP Code:
$this->form_validation->set_rules('field_name''''some_rule|another_rule'); 



RE: Validation errors - Narf - 10-19-2016

(10-19-2016, 05:28 AM)dave friend Wrote: form_validation->set_rules takes three arguments - field name, field label, rules.  Documentation here

Looks like you are only providing two arguments.

Try this

PHP Code:
$this->form_validation->set_rules('field_name''''some_rule|another_rule'); 

There's an actual problem hidden here ... The OP did use it incorrectly, but the third parameter should be forcefully required with this usage.

Such is the general issue with having to maintain multiple options and features in one place - allowing set_rules($array_of_stuff) prevents us from making the other parameters non-optional, and obviously nobody thought of actual logical checks for that.


RE: Validation errors - Narf - 10-20-2016

https://github.com/bcit-ci/CodeIgniter/commit/5d05372f4f59d27fdd93249d813970fcf181a4af