Skip to content

Commit 9eedc6d

Browse files
committed
Create form-modal.html
Added modal loading screen with progressbar animation for bootstrap3
1 parent 1e05d73 commit 9eedc6d

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

form-validator/form-modal.html

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Form Test</title>
6+
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-wip/css/bootstrap.min.css" />
7+
<style>
8+
.get-in-touch {
9+
position: relative;
10+
margin: 0 auto;
11+
padding: 30px;
12+
max-width: 370px;
13+
border-radius: 2px;
14+
background: rgb(255, 255, 255) url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAGCAYAAACFIR03AAAAV0lEQVR42tXOMRWAQAwE0RWFDRTg5d47Jeg4Q9gI06RbqlwKil/P6LpXbDCf85AxEBtMGjKG/jyPUHUerfP4nEeoOo/Wedj5pOo8Wudh55Oq82idh51PLxpvled7kLAXAAAAAElFTkSuQmCC) repeat-x;
15+
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
16+
}
17+
18+
.get-in-touch input[type=text],.get-in-touch input[type=email], .get-in-touch textarea {
19+
background: rgb(235, 241, 245);
20+
color: rgb(36, 39, 41);
21+
}
22+
.get-in-touch input:focus, .get-in-touch textarea:focus {
23+
outline: 0;
24+
background: #FFF;
25+
}
26+
</style>
27+
</head>
28+
<body>
29+
<div class="container">
30+
<div class="row">
31+
<div class="col-mid-4">
32+
<form action="#" method="post" class="form" id="myForm">
33+
<div class="get-in-touch">
34+
<h3 class="text-center">
35+
Test Form</h3>
36+
<div class="form-group">
37+
<input type="text" class="form-control" id="name" placeholder="Name" data-validation="required" />
38+
</div>
39+
<div class="form-group">
40+
<input type="email" class="form-control" id="Email" placeholder="Email" data-validation="email"/>
41+
</div>
42+
<div class="form-group">
43+
<textarea class="form-control" rows="3" placeholder="Message" data-validation="required"></textarea>
44+
45+
</div>
46+
<p> <input name="submit" type="submit" class="btn btn-danger" id="submit" value="Submit Form"></p>
47+
48+
</div>
49+
</form>
50+
</div>
51+
</div>
52+
</div>
53+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
54+
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
55+
<script src="jquery.form-validator.js"></script>
56+
<script>
57+
$(document).ready(function(){
58+
// modification to the validation to load a modal progress bar by Miguel
59+
var sadesApp;
60+
sadesApp = sadesApp || (function () {
61+
var pleaseWaitDiv = $('<div class="modal fade" tabindex="-1" id="pleaseWaitDialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h1>Processing please wait...</h1></div><div class="modal-body"><div class="progress progress-striped active"><div class="progress-bar" role="progressbar" style="width: 100%;"></div></div></div></div></div></div>');
62+
return {
63+
showPleaseWait: function() {
64+
pleaseWaitDiv.modal('show');
65+
},
66+
hidePleaseWait: function () {
67+
pleaseWaitDiv.modal('hide');
68+
},
69+
70+
};
71+
})();
72+
73+
74+
$.validate({
75+
form : '#myForm',
76+
errorMessagePosition : 'top', // Instead of 'element' which is default
77+
scrollToTopOnError : true, // Set this property to true if you have a long form
78+
79+
onSuccess : function() {
80+
sadesApp.showPleaseWait();
81+
return false; //
82+
},
83+
});
84+
});
85+
</script>
86+
</body>
87+
</html>

0 commit comments

Comments
 (0)