[eluser]mikedfunk[/eluser]
[quote author="Crimp" date="1208617274"]I always set validation rules and fields in private functions. It allows for re-use and keeps the controllers cleaner in terms of displaying the logic. If there are, for example, additional fields in an 'edit' version of a form (a user signs up with minimal info, edits more fields), I include an argument in the validation setting function and a switch for the added fields.[/quote]
Thanks for this. It's really helpful to reuse validation code like this. Note - because of variable scope, it only works if you run the set_rules and set_fields functions inside the private function.