"Form Registration"
Bootstrap 3.2.0 Snippet by junrillg

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="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<div class="form-box">
<h1>Form <span>Registration</span></h1>
<form role="form" id="contact-form">
<!-- name field -->
<div class="form-group">
<div id="nameError" class="alert" role="alert"></div>
<label for="form-name-field" class="sr-only">Name</label>
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-user"></span></div>
<input type="text" class="form-control" id="form-name-field" value="" placeholder="Name">
</div>
</div>
<!-- email field -->
<div class="form-group">
<div id="emailError" class="alert" role="alert"></div>
<label for="form-email-field" class="sr-only">Email</label>
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span></div>
<input type="email" class="form-control" id="form-email-field" value="" placeholder="Email">
</div>
</div>
<!-- phone field -->
<div class="form-group">
<div id="phoneError" class="alert" role="alert"></div>
<label for="form-phone-field" class="sr-only">Phone</label>
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-phone"></span></div>
<input type="phone" class="form-control" id="form-phone-field" value="" placeholder="Phone">
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
body {
background-color: lightblue;
}
.form-box {
width: 50%;
margin: auto;
padding-top:20px;
}
.form-box h1 {
text-align: center;
font-weight: bold;
text-transform: uppercase;
color: tomato;
}
.form-box h1 span {
font-weight: lighter;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
document.getElementById("contact-form").onsubmit = function() {
var nameValidate = /[a-z]/;
//Validate Name
if(document.getElementById("form-name-field").value == "") {
document.getElementById("nameError").innerHTML = "Please Enter A Name";
document.getElementById("nameError").className = "alert-danger";
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: