validation rules from 1 to 9 - 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: validation rules from 1 to 9 (/showthread.php?tid=19942) |
validation rules from 1 to 9 - El Forum - 06-23-2009 [eluser]aktosci[/eluser] I would like to check a value from 1 ( min ) to 9 ( max ) : I did that Code: $this->form_validation->set_rules('licoef', 'coef', 'integer'|'exact_length[1]'); but when I put 12 I don't get an error message validation rules from 1 to 9 - El Forum - 06-23-2009 [eluser]Dam1an[/eluser] The rules all need to be one string, Code: // So instead of validation rules from 1 to 9 - El Forum - 06-23-2009 [eluser]TheFuzzy0ne[/eluser] That's because your syntax is incorrect. The rules are a single string parameter: Code: $this->form_validation->set_rules('licoef', 'coef', 'integer|exact_length[1]'); EDIT: Poop. validation rules from 1 to 9 - El Forum - 06-23-2009 [eluser]aktosci[/eluser] Great !!!! It works !! thank you Now I would like to enlarge the question ( for the future ) how to check a min and max value for example ( from 5 to 15 )? validation rules from 1 to 9 - El Forum - 06-23-2009 [eluser]TheFuzzy0ne[/eluser] Create a custom method in your controller. Code: function _validate_liceof($str="") |