Reputation: 7766
i am having a razor code as below
@using (Html.BeginForm("OtherUpdateRequest", "Members", FormMethod.Post,
new { name = "form1", id = "form1", enctype = "multipart/form-data" }))
{
.......
<input type="button" value="Update Members" name="update" id="update" class="btn btn-success">
}
and in script area after some validation the form is getting submitted as below
$("#update").on('click', function () {
......
if (error == 0)
{
alert(error);
$("#errorDiv").hide();
$("#form1").submit();
}
});
it is alerting the value of error
. SO it is getting inside the if condition but the form is not getting submitted.
If i change the input code as below it will get submitted but i need some jquery validation so the submit can only done through jquery. Please let me know anything wrong I am doing.
<input type="Submit" value="Update Members" name="update" id="update"
class="btn btn-success">
Also if I place Submit() above the alert statement the alert also won't work..
$("#update").on('click', function () {
......
if (error == 0)
{
$("#form1").submit();
alert(error);
$("#errorDiv").hide();
}
});
Upvotes: 0
Views: 1392