Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6911179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:55:07+00:00 2026-05-27T08:55:07+00:00

I am trying to program in MVC architecture. So, I have one HTML form

  • 0

I am trying to program in MVC architecture.

So, I have one HTML form where user can insert, let’s say, a movie. I have one controller for that (for adding that movie) and one view for the HTML form.

But I also want user to be able to edit that movie after he added it. So, he presses a button “Edit a movie” and he’s redirected to the new URL and I have new controller and new view (it has the same form as when user adds the movie, but only now he sees values in inputs which he entered previously, I hope you understand what I mean) for this editing form.

Also, when I want to show how his movie looks like to other users, I once more time have new Controller and new View for that.

edit: I also have to validate what he enters. So, that validations should be in model? Because I validate twice, it doesn’t seem right.

Is it correct thinking of MVC? Or what’s the best approach for making this? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:55:07+00:00Added an answer on May 27, 2026 at 8:55 am

    You got it almost right, but there is still some place to simplify it. Common thing is to create action functions inside of your controller which handle certain (surprise, surprise) actions user can do. Usually you’d have, for example, Article controller with actions add, remove, edit etc. This way you centralize actions for common entity of your application and prevent overflow of controllers. It’s easier to maintain, easier to find if you want to change something asap and you will nicely follow DRY principle.

    Another thing you could do is to create abstract base controller for common stuff that’s used in multiple controllers (dynamic loading of meta data from database comes in mind).

    Having multiple views is fine. You don’t have much of a choice anyway. But I’d recommend using some templating engine which would make your life easier and once again force you to not repeat yourself. Twig or Smarty would be perfect choice.

    Validation logic should be located in model. Model is responsible for most of the backend logic (data manipulation, its validation…). Controllers just take requests, loads appropriate data from Models and point you to proper View. Don’t get confused though, you usually end up validating your Models inside Controller (calling validate() functions, for example).

    Anyway, in the end, you’ll find out there are quite many ways how to look at MVC pattern. Some people prefer “fat models” and “skinny controllers”, some the other way around. Use whatever fits your needs and keep it simple!

    If you want some studying materials, take a look at Symfony2 framework or CakePHP tutorials. There are some valuable information regarding this topic. Maybe you’ll end up using one of them instead of reinventing the wheel 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a program where that only one user can be
I am trying to program (while learning JQuery) the following: I have a form
I'm trying to have a View where the user can add items in a
I am trying to build a program using model-view-controller. Specifically: I have a state
Imagine we have a program trying to write to a particular file, but failing.
I have a .net MDI application written in vb.net. I'm trying to program a
I have this output when trying to debug Program received signal SIGSEGV, Segmentation fault
I am a relatively new user of Visual Studio and I am trying program
I am trying to program a game in which I have a Table class
I'm trying to debug a problem (exception being thrown) in an ASP.NET MVC program

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.