CodeIgniter Forums
Get validation rules - 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: Get validation rules (/showthread.php?tid=16472)

Pages: 1 2


Get validation rules - El Forum - 03-11-2009

[eluser]xwero[/eluser]
If the library isn't loaded in the controller and the rules aren't set the _field_data class variable will be empty.


Get validation rules - El Forum - 03-11-2009

[eluser]pistolPete[/eluser]
And if no POST request was made, it's empty as well:

Form_validation.php
Code:
function set_rules($field, $label = '', $rules = '')
{
        // No reason to set rules if we have no POST data
        if (count($_POST) == 0)
        {
            return;
        }
(...)



Get validation rules - El Forum - 03-11-2009

[eluser]xwero[/eluser]
This means loading the config file is the only solution to show the rules in the form.