-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
146 lines (135 loc) · 4.01 KB
/
index.html
File metadata and controls
146 lines (135 loc) · 4.01 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html>
<head>
<title>Custom Validation Library</title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
/>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link
rel="stylesheet"
href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"
/>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<div class="container mt-5">
<form id="myForm">
<div class="form-group">
<label for="name">Name*</label>
<input
type="text"
class="form-control"
name="name"
placeholder="Name"
/>
</div>
<div class="form-group">
<label for="email">Email*</label>
<input
type="text"
class="form-control"
name="email"
placeholder="Email"
/>
</div>
<div class="form-group">
<label for="role">Role*</label>
<select name="role" id="role">
<option value="">Select Role</option>
<option value="role1">Subscriber</option>
<option value="role2">Contributor</option>
<option value="role3">Administrator</option>
</select>
</div>
<button type="submit" class="btn btn-primary" id="submitButton">
Submit
</button>
</form>
</div>
<script src="./validations.js"></script>
<script>
$("#myForm").customValidation({
rules: {
name: ["required", "validName"],
email: ["required", "validEmail"],
role: ["required"],
},
messages: {
name: {
required: "Name is required.",
alphabeticWithSpace: "Please enter alphabetic characters only.",
},
email: {
required: "Email is required.",
validEmail: "Please enter a valid email address.",
},
},
success: function () {
console.log("Success");
},
});
/* let currentStep = 0;
const steps = $(".step");
const submitButton = $("#submitButton");
const prevButton = $("#prevButton");
const nextButton = $("#nextButton");
function updateButtonVisibility() {
if (currentStep === steps.length - 1) {
submitButton.show();
nextButton.hide();
} else {
submitButton.hide();
nextButton.show();
}
if (currentStep === 0) {
prevButton.hide();
} else {
prevButton.show();
}
}
updateButtonVisibility();
$("#nextButton").on("click", function () {
if (currentStep < steps.length - 1) {
// steps.eq(currentStep).hide();
// currentStep++;
// steps.eq(currentStep).show();
// updateButtonVisibility();
let form = $("#myForm");
form.submit();
}
});
$("#prevButton").on("click", function () {
if (currentStep > 0) {
steps.eq(currentStep).hide();
currentStep--;
steps.eq(currentStep).show();
updateButtonVisibility();
}
}); */
</script>
<script>
/* $(function () {
let currentDate = new Date();
$(".fromdatepicker").datepicker({
dateFormat: "mm-dd-yy",
maxDate: currentDate,
onSelect: function (selectedDate) {
// Trigger validation for the To Date input
$("#myForm").trigger("datepickerSelect", ["fromDate"]);
$(this).datepicker("hide");
},
});
$(".todatepicker").datepicker({
dateFormat: "mm-dd-yy",
maxDate: currentDate,
onSelect: function (selectedDate) {
// Trigger validation for the To Date input
$("#myForm").trigger("datepickerSelect", ["toDate"]);
},
});
}); */
</script>
</body>
</html>