Skip to content

Commit be3082a

Browse files
committed
Merge branch 'eugenebolshakov-manually_submit_form_with_validator' into dev
2 parents 011a546 + 6e9071e commit be3082a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/validator/validator.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@
510510
if (!self.checkValidity(null, e)) {
511511
return e.preventDefault();
512512
}
513+
// Reset event type and target
514+
e.target = form;
515+
e.type = conf.formEvent;
513516
});
514517
}
515518

test/validator/submit_manually.htm

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<script src="../js/jquery-1.4.2.min.js"></script>
3+
<script src="../../src/validator/validator.js"></script>
4+
5+
<form action="http://google.com/search" style="margin:100px">
6+
7+
<label>
8+
requred text
9+
<input name="q" type="text" required="required" />
10+
</label>
11+
12+
<a href="#" class="submit">Submit</a>
13+
</form>
14+
15+
<script>
16+
$("form").validator({ position: 'top center'});
17+
$("a.submit").click(function(event) {
18+
event.preventDefault();
19+
$("form:first").submit();
20+
});
21+
</script>

0 commit comments

Comments
 (0)