Architecture: Where to Put Forms?

#1
[eluser]fireproofsocks[/eluser]
This is an architecture question: where do you put the code that makes your forms? I'm always a big fan of leaving as much open to the front-end designers as possible, but forms are areas where the MVC architecture gets blurry. I'm wondering how others handle forms in their code... do you guys create a separate library-type file that you can use with different controllers? Or do you put the form code in a view? Just curious...

#2
[eluser]bigtony[/eluser]
Forms are things that people view, so the "View" seems like a logical place to define the html for them within the MVC architecture.

#3
[eluser]Johan André[/eluser]
Is there any other way than a view file?
Echoing from the controller/library is out the question.

I design one form for each function (usually that's one database table / form too).
I then use it for both my add and edit-view.

#4
[eluser]boony[/eluser]
[quote author="Johan André" date="1254232184"]Is there any other way than a view file?
Echoing from the controller/library is out the question.

I design one form for each function (usually that's one database table / form too).
I then use it for both my add and edit-view.[/quote]

Hi,

for what it's worth (2c I think) I also do much the same. I generally have a model for each table and a controller for each model. Forms are used to CRUD the table and are used for the view. So I keep all forms in a sub-directory in the view directory.

Not sure if I'm making myself clear but hey it works for me.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.