[eluser]gon[/eluser]
Quote:So it seems to me that you either need to add some flow structure in your controller to test which form to set the rules/fields for, or set the forms to submit to different controllers.
Either way, you end up repeating code, especially for data that you need to pass to your view on every call.
You could use a single action for both forms, and send the hidden field to know which form it is.
In the action, you could have an array containing all validation rules from both forms.
And another array that stores which rules must be set for every form.
Then you would build the validation rules array looking at these 2 arrays.
And you shouldn't have to put conditions.
Having done this in the past, now I would go for 2 actions.
Repeating code? Why you couldn't factor the common code in private functions on the controller, or as libraries?
I say private functions cause these utility functions shouldn't be actions for the controller.
cheers