vendredi 24 juillet 2015

Ajax.BeginForm not creating a form tag inside the dom

In my MVC project I'm using an ajax form to dynamically update some search results based on a modified search term.

When rendering the Ajax.BeginForm() Method, it doesn't render a <form> tag on the page (in the DOM)

everything is set up fine, Jquery, Unobtrusive and AJAX are all referenced and I have working Ajax.BeginForm instances elsewhere

@using (Ajax.BeginForm("FilterSearch","Attachment", new AjaxOptions()
        OnComplete = "updateSearchResults",
        HttpMethod = "POST"
        @Html.HiddenFor(model => model.AccountId)
        @Html.HiddenFor(model => model.ContactId)
        @Html.HiddenFor(model => model.OpportunityId)

        @Html.TextBoxFor(model => model.SearchTerm, new { placeholder = "Search Term", @class = "header-search-box" })
        <input type="submit" class="header-search-input" />

is just rendering inside the DOM as

<input id="AccountId" name="AccountId" type="hidden" value="">
<input id="ContactId" name="ContactId" type="hidden" value="">
<input id="OpportunityId" name="OpportunityId" type="hidden" value="O6UJ9A001TB1">
<input class="header-search-box" id="SearchTerm" name="SearchTerm" placeholder="Search Term" type="text" value="">
<input type="submit" class="header-search-input">

Aucun commentaire:

Enregistrer un commentaire