CodeIgniter Forums
Method "CI_Validation::set_fields()" for the new version class "CI_Form_validation" of the latest version CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Method "CI_Validation::set_fields()" for the new version class "CI_Form_validation" of the latest version CodeIgniter (/showthread.php?tid=47306)



Method "CI_Validation::set_fields()" for the new version class "CI_Form_validation" of the latest version CodeIgniter - El Forum - 12-02-2011

[eluser]pierrehs[/eluser]
Hello,
I'm trying to migrate my old site with the old version of CodeIgniter to the latest version (2.1).

But with the validation class, I would like to know what the new method similar to old class "CI_Validation::set_fields()" for the new class "CI_Form_validation"
Tthank you


Method "CI_Validation::set_fields()" for the new version class "CI_Form_validation" of the latest version CodeIgniter - El Forum - 05-24-2012

[eluser]Maulwurf[/eluser]
1.5 until 1.7.2 for example.
"Note: To display errors this way you must remember to set your fields using the $this->validation->set_fields function described earlier. The errors will be turned into variables that have "_error" after your field name. For example, your "username" error will be available at:
$this->validation->username_error."

from comparing the old and the new docs, I'd say, set_fields has gone and has merged into set_rules, which now takes 3 parameters instead of one.