Following is JS Code:
$('#createCust').on('click', function(e) {
e.preventDefault();
documentCommon.ajax({
dataType : 'text',
url : "/createcustomer",
data : $("body form:first").serialize(),
success : function(data) {
$(".dialogTitle").html("");
$(".dialogTitle").html("Add Customer");
$(".actualData").html("");
$(".actualData").html(data);
$('#modalViewDialog').modal('show');
}
});
});
Following is button:
<form:form method="POST" modelAttribute="customerForm"
class="form-signin" action="/createcustomer">
<form:input type="text" path="customerName" class="form-control"
placeholder="Customer Name" required="required"></form:input>
<button type="submit" id="createCust" class="btn btn-primary">Create</button>
When i remove JS code then it works fine but i want ajax call so i could not rely on whole page submit. Is there any way to enabled all required field check on JS call too?