-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_script.js
78 lines (76 loc) · 2.57 KB
/
my_script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
$(document).ready(function () {
Login();
});
function Login() {
$(document).on('click', '.login', function () {
$.validator.setDefaults({
submitHandler: function () {
Swal.fire({
position: 'top-end',
icon: 'success',
title: 'Your record has been saved.',
showConfirmButton: false,
timer: 1500
})
$("#loginForm").trigger('reset');
}
})
$("#loginForm").validate({
errorClass: 'error',
rules: {
reg: "required",
fName: "required",
lname: "required",
address: "required",
gender:"required",
email: {
email: true,
required: true
},
dob: "required",
phone: {
required: true,
digits: true,
maxlength: 10,
minlength: 10
},
nic: {
required: true,
maxlength: 12,
minlength: 10
}
},
messages: {
reg: "Please enter your registration number",
fName: "Please enter your first name ",
lname: "Please enter your last name",
address: "Please enter your address",
gender:"Please select a gender<br/>",
email: {
email: "Please Enter The Valid Email Address",
required: "Please Enter Your Email Id"
},
dob: "Please enter your date of birth",
phone: {
required: "Please Enter Your Contact number",
digits: "Cotact No Must Be numeric",
maxlength: "length Must 10",
minlength: "length must 12"
},
nic: {
required: "Please Enter Your nic number",
maxlength: "length Must 12",
minlength: "length must 10"
}
},
errorPlacement: function (error, element) {
if (element.is(":radio")) {
error.appendTo(element.parents('.cont'));
}
else { // This is the default behavior
error.insertAfter(element);
}
}
})
});
}