MVC design question for forms

Posted by kenny99 on Stack Overflow See other posts from Stack Overflow or by kenny99
Published on 2010-03-24T15:38:05Z Indexed on 2010/03/24 15:53 UTC
Read the original article Hit count: 395

Hi, I'm developing an app which has a large amount of related form data to be handled. I'm using a MVC structure and all of the related data is represented in my models, along with the handling of data validation from form submissions. I'm looking for some advice on a good way to approach laying out my controllers - basically I will have a huge form which will be broken down into manageable categories (similar to a credit card app) where the user progresses through each stage/category filling out the answers. All of these form categories are related to the main relation/object, but not to each other.

Does it make more sense to have each subform/category as a method in the main controller class (which will make that one controller fairly massive), or would it be better to break each category into a subclass of the main controller? It may be just for neatness that the second approach is better, but I'm struggling to see much of a difference between either creating a new method for each category (which communicates with the model and outputs errors/success) or creating a new controller to handle the same functionality.

Thanks in advance for any guidance!

© Stack Overflow or respective owner

Related posts about web-development

Related posts about mvc