C# ASP.NET MVC Forms Creating a Basic Form Using HTML Helpers

What's wrong with my Html.BeginForm() method?

May I know what I'm doing wrong with this practice? There were no classes given, so I've excluded those, but even with the addition of classes, the practice validation keeps throwing exception. The error I got was "Bummer, did you remove any of the provided code?" I'm not sure where to go from this.

Report.cshtml
@using (Html.BeginForm())
{
    <div>
        @Html.Label("Name")
        @Html.TextBox("Name", null)
    </div>

    <div>
      @Html.Label("Email")
        @Html.TextBox("Email", null)
    </div>

    <div>
      @Html.Label("DepartmentId")
        @Html.TextBox("DepartmentId", null)
    </div>

    <div>
      @Html.Label("Severity")
        @Html.TextBox("Severity", null)
    </div>

    <div>
      @Html.Label("Reproducible")
        @Html.TextBox("Reproducible", null)
    </div>

    <div>
      @Html.Label("DescriptionOfProblem")
        @Html.TextArea("DescriptionOfProblem", null, 14, 20)
    </div>

    <button type="submit">Save</button>
}

1 Answer

Steven Parker
Steven Parker
148,894 Points

Tasks 2 and 3 ask you to change the label and input elements to Html helper methods for the "Name" field, but it looks like you changed the other fields as well. That "Bummer, did you remove any of the provided code?" message is a hint that you changed more than the challenge was expecting.

For best results with the challenges, always follow the instructions carefully and avoid adding or changing anything not explicitly asked for.

But I do admire your initiative, and even if the challenge doesn't want to see it, it looks llike you did a good job completing the conversions. :+1:

Ohhh I see! Thanks a lot! I kinda have OCD on completing tasks so i was doing this for quite the good hour...