Hi
How we can implement any of the above validations or like below link with the given code
https://www.dotnetcurry.com/jquery/1168/validate-form-jquery-bootstrap-validator
class= "table table-striped table-bordered" style="width:100%" id="tblLocation">
- @*
"checkbox" id="checkall" /> *@- Id
- Description
- IsActive
Action - class="tbody">
- class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">class="modal-dialog">class="modal-content">class="modal-header">
- class="close" data-dismiss="modal">"true">×class="sr-only">Close
class
="modal-title">Add New Locationclass="modal-body">class="form-horizontal">class="form-group">- ="control-label col-sm-3" for="Id">Id
class="col-sm-2">- "text" class="form-control form-control-sm" id="txtId" placeholder="Id">
class="form-group">- ="control-label col-sm-3" for="Description">Description
class="col-sm-9">- "text" class="form-control form-control-sm" id="txtDescription" placeholder="Description">
class="form-group">- ="control-label col-sm-3" for="PType">Product Type
class="col-sm-2">- "text" class="form-control form-control-sm" id="txtPType" placeholder="Product Type">
class="modal-footer">- class="btn btn-primary" id="btnAdd" onclick="return Add();">Save
- class="btn btn-primary" id="btnUpdate" style="display:none;" onclick="Update();">Update
- class="btn btn-warning" data-dismiss="modal">Cancel
- function Add() {
- var res = validate();
- if (res == false) {
- return false;
- }
- var objLocation = {
- Id: $('#txtId').val().toUpperCase(),
- Description: $('#txtDescription').val().toUpperCase(),
- IsActive: $('#txtIsActive').val().toUpperCase()
- };
- $.ajax({
- url: "/Location/Add",
- data: JSON.stringify(objLocation),
- type: "POST",
- contentType: "application/json;charset=utf-8",
- dataType: "json",
- success: function (data) {
- //loadData();
- $('#tblLocation').DataTable().ajax.reload();
- $.notify(data.message, {
- globalposition: "top center",
- //position:"center",
- className:"success"
- })
- $('#myModal').modal('hide');
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert("Error");
- $("#msgModalBody").html('Status : ' + xhr.status + ' Error : ' + thrownError);
- $("#msgModal").modal('show');
- //
- }
- });
- }
Thanks
Sachin SinghPosted Jun 5, 2021, 8:37 AM