Skip to content

Commit 6e9071e

Browse files
committed
Merge branch 'manually_submit_form_with_validator' of https://github.com/eugenebolshakov/jquerytools into eugenebolshakov-manually_submit_form_with_validator
2 parents 88149a2 + bdee564 commit 6e9071e

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/scrollable/scrollable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
},
9393

9494
getItems: function() {
95-
return itemWrap.children(conf.item).not("." + conf.clonedClass);
95+
return itemWrap.find(conf.item).not("." + conf.clonedClass);
9696
},
9797

9898
move: function(offset, time) {

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)