Nav
Nav

Reputation: 95

Form post posting null

I'm trying to post some information from a form but it keeps posting null values to the Comment controller rather than what is entered on the page....

@using (Html.BeginForm("SubmitComment", "Comment",FormMethod.Post))
{
     <fieldset>
        <legend>Submit a comment</legend>
        <input id="comment" type="text" />

        <button type="submit">Submit</button>

    </fieldset>
}

Any ideas?

Upvotes: 1

Views: 123

Answers (1)

leskovar
leskovar

Reputation: 661

Add the name="comment" attribute to the input.

Upvotes: 4

Related Questions