Welcome Guest, Not a member yet? Register   Sign In
Handling multiple forms on a single view - what crafty ways are there to handle this?
#15

[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.


Messages In This Thread
Handling multiple forms on a single view - what crafty ways are there to handle this? - by El Forum - 10-05-2008, 02:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB