jQuery validation does not work on multiple form created from same partial view. However only first form is trigger validation.
Hi all,
More than one forms are created on same page using for loop. First form is validated but from second one, when submit button is clicked it does not triggered to jQuery validation.
Here is my code:
@using (Html.BeginUmbracoForm("PostComment", "CommentController", System.Web.Mvc.FormMethod.Post, new { id = "Comment_" + answerId + "-"
+ commentParentId, @class = "Comment" }))
{
some input field
<input class="" type="submit" value="Submit" id="commentBtn" />
}
<script>
$("#commentBtn").click(function () {
debugger;
var id = $(this).parent().attr("id").split('_')[1];
$("#comment_" + id).bootstrapValidator({
// To use feedback icons, ensure that you use Bootstrap v3.1.0 or later
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
Name: {
validators: {
notEmpty: {
message: 'Please Enter Your Name'
}
}
},
Comment: {
validators: {
notEmpty: {
message: 'Please Enter the Comment'
}
}
}
}
});
});
</script>
There is not any error on console of browser. I am unable to understand how first form was validated but not others. Can you please suggest me any solution.
jQuery validation does not work on multiple form created from same partial view. However only first form is trigger validation.
Hi all,
More than one forms are created on same page using for loop. First form is validated but from second one, when submit button is clicked it does not triggered to jQuery validation.
Here is my code:
There is not any error on console of browser. I am unable to understand how first form was validated but not others. Can you please suggest me any solution.
Many Thanks.
is working on a reply...