Skip to content

Commit baf14b6

Browse files
authored
Merge pull request #28 from ljbc1994/master
Adding the 'formnovalidate' attribute to the form's submit button prevents validation
2 parents c48f44f + 2ee413e commit baf14b6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

dist/jquery.unobtrusive-ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
$(document).on("submit", "form[data-ajax=true]", function (evt) {
172172
var clickInfo = $(this).data(data_click) || [],
173173
clickTarget = $(this).data(data_target),
174-
isCancel = clickTarget && clickTarget.hasClass("cancel");
174+
isCancel = clickTarget && (clickTarget.hasClass("cancel") || clickTarget.attr('formnovalidate') !== undefined);
175175
evt.preventDefault();
176176
if (!isCancel && !validate(this)) {
177177
return;

dist/jquery.unobtrusive-ajax.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery.unobtrusive-ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
$(document).on("submit", "form[data-ajax=true]", function (evt) {
172172
var clickInfo = $(this).data(data_click) || [],
173173
clickTarget = $(this).data(data_target),
174-
isCancel = clickTarget && clickTarget.hasClass("cancel");
174+
isCancel = clickTarget && (clickTarget.hasClass("cancel") || clickTarget.attr('formnovalidate') !== undefined);
175175
evt.preventDefault();
176176
if (!isCancel && !validate(this)) {
177177
return;

0 commit comments

Comments
 (0)