Question

I have a HTML form which is in a partial that is loaded via jquery.load(). My partial looks something like this:

@Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data", id = "addComicForm"}){ 
<div class="add-comic-submit">
    <input type="submit" value="haha" name="haha" />
</div>
}

On IE7-8 It's not rendered properly and does not create a form attribute, however, if I manually insert the form code such as

<form action="/ManageComics/ComicAdder" enctype="multipart/form-data" id="addComicForm" method="post" novalidate="novalidate"> </form>

It works properly.

Was it helpful?

Solution

Because you are doing it wrong. It should be like this:

@using (Html.BeginForm("ComicAdder", "ManageComics", FormMethod.Post, new { enctype = "multipart/form-data", id = "addComicForm" }))
{ 
    <div class="add-comic-submit">
        <input type="submit" value="haha" name="haha" />
    </div>
}

OTHER TIPS

another way should like this:

@{
    Html.BeginForm("your actionName", "your controllerName", FormMethod.Post);
}
<div class="add-comic-submit">
   <input type="submit" value="haha" name="haha" />
</div>
@{
    Html.EndForm();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top