-1

I have to code a gui like this:

enter image description here

It's an homepage with a left menu and a changing right part, on button1 click form1 must be displayed, on button2 click form2 a so on. Each form has its own button "ok" that would call a controller function which will save data entered by the user in a database (but it is not relevant).

My question is: I know that according to MVC pattern user button click should call a controller function, so what would the controller do on button1 click? There are 2 scenarios in my mind:

1) Controller create the form1 and then pass it to the homepage view which will just show it on the right.

2) Controller just call the appropriate method of the Homepage view which will create form1 and will show it.

EDIT: What i would know is: is it a job of the controller to create each view corresponding to the form and then pass it to the homepage view, or it just call a method of the homepage view which will create and display it?

1
  • Can you explain me why are you downvoting? If you downvote without any explanation how am I supposed to understand where is the problem? – Diablo3000 Mar 10 '20 at 10:11
0

Well,

button 1, button 2 and e.t.c. should act like navigation. When you click on "button 1" it should redirect to Form 1 Controller. When you click on "button 2" it should redirect to Form 2 Controller.

For each form I recommend use separate controller.

1
  • Maybe i've not explained myself very well, I want to know if it's a controller job to create each view corresponding to the form and then pass it to the homepage view, or it just call a method of the homepage view which will create and display it? I added it to the main post. – Diablo3000 Mar 9 '20 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.