This repository has been archived by the owner on Aug 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform.html
218 lines (212 loc) · 7.02 KB
/
form.html
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html>
<head>
<title>ajaxPostForm PoloPlugin</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="polosson">
<link href="vendor/bootstrap.min.css" rel="stylesheet" />
<script src="vendor/jquery-2.0.1.min.js"></script>
<script src="vendor/bootstrap.min.js"></script>
<script src="js/jquery.messageBox.js"></script>
<script src="js/jquery.ajaxPostForm.js"></script>
<script>
$(function(){
// Message box example
$.messageBox({'message':"Welcome !!"});
// Ajax Form example
$('#testform, #testform2').ajaxPostForm({
onSubmit: function(R) {
if (R.params.data.email == "polo@test.com")
throw "I do not allow you to post here because you have to use your own adress email !";
return true;
},
onSuccess: function(R){
$.messageBox({
"cssClass":'alert-info',
"message":R.message+'<br /><span class="text-danger">'+JSON.stringify(R.data)+'</span>'
});
}
});
// Documentation loader
$('.doc').click(function(){
var toLoad = $(this).data("to-load");
$('#docLoader').load('doc/'+toLoad+'.html');
});
});
</script>
</head>
<body style="overflow-y: scroll;">
<div class="container-fluid">
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-10 alert alert-warning">
<div class="pull-right" id="ajaxLoader" style="display:none;">LOADING...</div>
<h2><a href="index.html">JQuery Polo Plugins</a></h2>
<a class="btn btn-primary" href="message.html">jquery.messageBox.js</a>
<a class="btn btn-warning" href="form.html">jquery.ajaxPostForm.js</a>
<a class="btn btn-primary" href="table.html">jquery.ajaxActions.js</a>
</div>
</div>
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-6">
<h3>Jquery plugin to send form via ajax POST - <small>jquery.ajaxPostForm.js</small> -</h3>
<div id="testform" class="well" style="margin-top: 20px;">
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<h4>#testform</h4>
</div>
<div class="col-lg-2 text-right">
INPUT
</div>
<div class="col-lg-10">
<input type="text" class="form-control" autocomplete="off" data-rules='{"r":1, "m":6}' name="input" />
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
PASSWORD
</div>
<div class="col-lg-10">
<input type="password" class="form-control" autocomplete="off" name="passwd" />
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
TEXT
</div>
<div class="col-lg-10">
<textarea class="form-control" autocomplete="off" name="textarea"></textarea>
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
SELECT
</div>
<div class="col-lg-10">
<select class="form-control" name="select">
<option value=""></option>
<option value="opt2">Option 2</option>
<option value="opt3">Option 3</option>
<option value="opt4">Option 4</option>
<option value="opt5">Option 5</option>
</select>
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
MULTI SELECT
</div>
<div class="col-lg-10">
<select class="form-control" style="height: 120px;" name="multiselect" multiple>
<option value="opt1">Option 1</option>
<option value="opt2">Option 2</option>
<option value="opt3">Option 3</option>
<option value="opt4">Option 4</option>
<option value="opt5">Option 5</option>
</select>
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
CHECKBOXES
</div>
<div class="col-lg-10">
<div class="btn-group" data-toggle="buttons" data-rules='{"r":1}'>
<label class="btn btn-sm btn-default">
<input type="checkbox" name="checkboxes" autocomplete="off" value="chk1" /> Checkbox 1
</label>
<label class="btn btn-sm btn-default">
<input type="checkbox" name="checkboxes" autocomplete="off" value="chk2" /> Checkbox 2
</label>
<label class="btn btn-sm btn-default">
<input type="checkbox" name="checkboxes" autocomplete="off" value="chk3" /> Checkbox 3
</label>
<label class="btn btn-sm btn-default">
<input type="checkbox" name="checkboxes" autocomplete="off" value="chk4" /> Checkbox 4
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
RADIOS
</div>
<div class="col-lg-10">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-sm btn-default active">
<input type="radio" name="radios" autocomplete="off" checked="checked" value="rad1" /> Radio 1
</label>
<label class="btn btn-sm btn-default">
<input type="radio" name="radios" autocomplete="off" value="rad2" /> Radio 2
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
</div>
<div class="col-lg-10">
<button class="btn btn-success submitBtn" data-destination="actions/A_test.php" data-action="testOne">SEND</button>
</div>
</div>
</div>
<div id="testform2" class="well" style="margin-top: 50px;">
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<h4>#testform2</h4>
</div>
<div class="col-lg-2 text-right">
EMAIL
</div>
<div class="col-lg-10">
<input type="text" class="form-control" name="email" autocomplete="off" data-rules='{"r":1,"f":"email"}' value="polo@test.com" />
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
PASSWORD
</div>
<div class="col-lg-10">
<input type="password" class="form-control" name="password" autocomplete="off" data-rules='{"r":1,"m":6,"M":20,"f":"password"}' value='megapsswd*' />
</div>
</div>
<div class="row">
<div class="col-lg-2 text-right">
</div>
<div class="col-lg-10">
<button class="btn btn-success submitBtn"
data-destination="actions/A_test.php"
data-action="testTwo"
data-extra-params='{"extra1":"wouzah", "extra2":"wazaa"}'>
SEND
</button>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="row" style="margin-top:30px;">
<div class="alert hide" id="messageBox"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-7 alert-warning">
<button class="btn btn-info doc pull-right" data-to-load="doc.messageBox">DOC messageBox</button>
<button class="btn btn-primary doc" data-to-load="doc.ajaxPostForm">DOC ajaxPostForm.js</button>
</div>
</div>
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-10">
<div style="padding-bottom:150px;" id="docLoader"></div>
</div>
</div>
</div>
</body>
</html>