php - Multiple views for the same form in a web application -


i have situation have several ways perform same activity in php web app.

there "manage widgets" section of app has form creating new widgets , list of existing widgets.

then somewhere else in app there button pops dialog add new widget.

then on home page of app there place form embedded add widget (think home page portal).

my question is: best practice this? in case of forms same. first instinct use same code 3 of these scenarios. on other hand, space on home page smaller , layouts may have differ between three.

so though repetition, better duplicate form 3 times (there proper model layer, duplicated code not include logic add/edit widget)? or try force single view in of these scenarios? both seem wrong me , hoping ideas discover sort of middle ground.

one approach have markup (not styles) form standalone file, can included anywhere like.

you can use ajax submit form specific php script handles form submission , returns meaningful json response. can display , style json response on page in question.

this way have single form (that can styled differently) , single handler view that's required use form.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -