Where do you store your data validation declarations? |
[eluser]housecor[/eluser]
I have a very large controller function that I'm refactoring, and I've noticed a common theme with my large controller functions is a big section of validation declarations like this: Code: $rules['parentcategory'] = "integer|max_length[20]|required"; So to make my controllers easier to read, I'd like to move these validation declarations to a separate function. Where is the most logical place to put this? A couple ideas: -A private function in the controller -A helper But how do I assure these values are still in scope for use in my views/models by calling $this->validation->myfield if I move this code out of the controller function? Thanks in advance!
[eluser]internut[/eluser]
You should first look at the new method of form validation. I believe you're using the old which is deprecated. http://ellislab.com/codeigniter/user-gui...ation.html http://ellislab.com/codeigniter/user-gui...e_170.html Its a pretty simple transition. It will shorten up your code. |
Welcome Guest, Not a member yet? Register Sign In |