Skip to content

Commit d14aee3

Browse files
committed
main(pat-validation): Create a validate_all API method.
1 parent e842f5b commit d14aee3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/pat/validation/validation.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ class Pattern extends BasePattern {
5353
// On submit, check all.
5454
// Immediate, non-debounced check with submit. Otherwise submit
5555
// is not cancelable.
56-
for (const input of this.inputs) {
57-
logger.debug("Checking input for submit", input, e);
58-
this.check_input({ input: input, event: e });
59-
}
56+
this.validate_all();
6057
},
6158
// Make sure this event handler is run early, in the capturing
6259
// phase in order to be able to cancel later non-capturing submit
@@ -74,6 +71,13 @@ class Pattern extends BasePattern {
7471
this.el.setAttribute("novalidate", "");
7572
}
7673

74+
validate_all() {
75+
// Check all inputs.
76+
for (const input of this.inputs) {
77+
this.check_input({ input: input, event: e });
78+
}
79+
},
80+
7781
initialize_inputs() {
7882
this.inputs = [
7983
...this.el.querySelectorAll("input[name], select[name], textarea[name]"),

0 commit comments

Comments
 (0)