Vous êtes sur la page 1sur 2

Assignment: Create a form to register user.

Difficulty Level: Moderate


Dead Line: Before the next lecture
The purpose of this assignment is to get you familiar with multiple types HTML
controls and help you to get a better grip on MVC architecture. In this assignment
you will get input from the user through multiple pages and show all of them at the
end.
The MVC scenario will be similar to the following diagram
V1 C M1
M1 V2 C M2
C M1, M2 V3
V1 = First View, V2 = Second View, V3 = Third View [Displays data of both models]
M1 = First Model, M2 = Second Model

Step 1
Create an Action [Name = PersonalDetails, MethodType=GET]
Create a View [Name = PersonalDetails] which takes input from the user for
the following fields
1. First Name [Input type = text]
2. Last Name [Input type = text]
3. Roll Number [Input type = text , set attribute Pattern to accept
correct format]
4. Gender [Input type = Radio Button]
5. Address [Input type = text , multiline]
6. Cell Number [Input type = text , set attribute Pattern to accept
correct format]
7. E-Mail [Input type = Email]
8. User name [Input type = text]
9. Password [Input type = Password]
10.Confirm Password [Input type = Password]
11.Button [Text= Next, Type= Submit]
Step 2
Create a Model [Name = PersonalDetailsModel] according to the above fields.
Step 3
Create an Action [Name = SavePersonalDetails, MethodType=POST] [Hint:
above form will submit here]

Create the Object [Name = M1] of model [Name = PersonalDetailsModel] in


the Controller Action [Name = SavePersonalDetails]
Set the fields of the model object
Return View [Name = EducationDetails]
Step 4
Create a view named [Name = EducationDetails]
Pass the object of Model to the View [Name = EducationDetails]
The View [Name = EducationDetails] will have the following fields
1.
2.
3.
4.
5.
6.
7.

Heading <h3> Intermediate Details


Name of Collage [Input type = text]
Year of Completion [Input type =Number]
Board [Input type =text]
Marks Obtained [Input type =Number]
Total Marks [Input type =Number]
Percentage [Will be calculated with Java Script] [Input type
=Number]
8. Heading <h3> SSC Details
9. School Name [Input type =text]
10.Year of Completion [Input type = number]
11.Board [Input type = text]
12.Marks Obtained [Input type =number]
13.Total Marks [Input type =number]
14.Percentage [Will be calculated with Java Script] [Input type
=number]
15.Submit Button [Input type =SUBMIT]
Step 5
Receive all 14 fields and the model M1 passed earlier to the view in the
Controller Action [Name = SaveEducationDetails, Method =POST]
Step 6
Create a new Model [Name = EducationDetailsModel] with fields according
to the view [Name = EducationDetails]
Create the object [Name=M2] of Model [Name =EducationDetailsModel]
Set the fields of the object [Name =M2] with the 14 fields received
Step 7
Send both Models M1 and M2 to the View [Name:DisplayUserData] [Hint:
you can either use ViewBags or Create a new Model which will contain the two
objects M1 and M2]
Display Models data in HTML

Vous aimerez peut-être aussi