// settings form validation
$( document ).ready(function() {
//api-form -- form ID
$("#api-form").validate({
rules: {
//input name
pnr_api_key: {
required: true,
minlength: 48
},
pnr_app_id: {
required: true,
minlength: 36
}
},
// Specify validation error messages
messages: {
pnr_api_key: {
required: "Please provide API Key",
minlength: "Your API KEY must be at least 48 characters long"
},
pnr_app_id: {
required: "Please provide APP ID",
minlength: "Your APP ID must be at least 32 characters long"
},
},
//to show error in a different field
errorPlacement: function(error, element) {
error.appendTo('.error');
},
submitHandler: function(form) {
form.submit();
}
});
});
//validation cdn link
https://cdn.jsdelivr.net/npm/jquery-validation@1.19.3/dist/jquery.validate.min.js
0 Comments