Skip to content

Commit 05284ff

Browse files
committed
added an test page for custom onsubmit event handler
1 parent 0787db6 commit 05284ff

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

test/validator/onsubmit.htm

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
<!DOCTYPE html>
3+
<script src="../js/jquery-1.4.2.min.js"></script>
4+
<script src="../../src/validator/validator.js"></script>
5+
6+
<form action="#" style="margin:100px">
7+
8+
<label>
9+
requred text
10+
<input type="text" required="required" />
11+
</label>
12+
13+
<button>Submit</button>
14+
15+
</form>
16+
17+
<script>
18+
$("form").validator({ position: 'top center'}).submit(function(e) {
19+
20+
// flag to see whether validation failed
21+
var failed = $(":input", this).hasClass("invalid");
22+
23+
// do not perform submit
24+
e.preventDefault();
25+
});
26+
</script>

test/validator/validator.htm

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,7 @@
2121
padding:0 5px;
2222
}
2323
</style>
24-
25-
<!--
26-
input attributes in HTML5
27-
# min
28-
# max
29-
# pattern
30-
# required
31-
# maxlength (no need to)
32-
# disabled
33-
# readonly
34-
# oninvalid
35-
- replace (next version perhaps)
3624

37-
type
38-
# number (good with max / maxlenght)
39-
# email
40-
# url
41-
# range (range)
42-
# date, datetime, month, time, week (dateinput)
43-
-->
4425

4526
<form action="#">
4627

0 commit comments

Comments
 (0)