I have a view that executes HttpPost.
It is working fine as long as I have just textboxes. I have added a datetime picker and dropdown lists, the form is automatically getting posted onclick of datetime picker and dropdowns. I cannot even see the datetime picker and dropdown list details, they just appear and disappear and form posts and it is showing required error messages.
The datetime picker and dropdowns are created using jquery widget.
can somebody advise how to stop automatic posting of form in MVC4?
below is my view:
@using P.B.O
@model O
@using (Html.BeginForm("Create", "O", FormMethod.Post))
{
@Html.ValidationSummary(true)
<fieldset>
<legend>Create a New Organization</legend>
<div class="editor-label">
@Html.LabelFor(model => model.C)
@Html.TextBoxFor(model => model.C, new { @class = "txt"})
@Html.ValidationMessageFor(model => model.C)
</div> <br />
<div class="editor-label">
@Html.LabelFor(model => model.N)
@Html.TextBoxFor(model => model.N, new { @class = "txt"})
@Html.ValidationMessageFor(model => model.N)
</div> <br />
<div class="editor-label">
@Html.LabelFor(model => model.D)
@Html.TextBoxFor(model => model.D, new { @class = "txt"})
@Html.ValidationMessageFor(model => model.D)
</div>
<div>
<label for="check" class="chk">
Del ?
<input id="IsSoftDeleted" name="IsSoftDeleted" data-val-required="The Del? field is required." data-val="true" type="checkbox" class="check" />
</label>
</div>
<br />
<input id="FromDate" name ="FromDate" data-val="true" type="datetime" class="datetime" />
<input type="submit" value="Create" />
</fieldset>
}