"Student Application"
Bootstrap 4.0.0 Snippet by SharatShetty

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
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<center><h3>School Admission Form</h3></center>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="First Name">First Name</label>
<div class="col-md-4">
<input id="First Name" name="First Name" type="text" placeholder="Enter First Name" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="Middle Name">Middle Name</label>
<div class="col-md-4">
<input id="Middle Name" name="Middle Name" type="text" placeholder="Enter Middle Name" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="Last Name">Last Name</label>
<div class="col-md-4">
<input id="Last Name" name="Last Name" type="text" placeholder="Enter Last Name" class="form-control input-md" required="">
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
.container {
border-radius: 5px;
background-color: lightgrey;
padding: 20px;
}
input[type=text], select, textarea{
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 12px;
box-sizing: border-box;
resize: vertical;
}
label {
padding: 12px 12px 6px 0;
display: inline-block;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
var minAge = 6;
var maxAge = 16;
function _calcAge() {
var date = new Date(document.getElementById("DOB").value);
var today = new Date();
var timeDiff = Math.abs(today.getTime() - date.getTime());
var age1 = Math.ceil(timeDiff / (1000 * 3600 * 24)) / 365;
document.getElementById('candAge').value = parseInt(age1);
return age1;
}
//Compares calculated age with minimum age and acts according to rules//
function setAge() {
var age = _calcAge();
//alert("my age is " + age);
if (age < minAge) {
window.alert("You are not allowed to apply for admission in school, minimum age is 6");
} else if (age > maxAge) {
window.alert("You are not allowed to apply for admission in school, maximum age is 16");
} else {
var std = parseInt(age) - 5;
window.alert("The suitable class to your age is " + std);
// window.open(main.htm, _self);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: