Skip to content

Commit 9a3a847

Browse files
committed
Updating script files to use 3.2.3 version.
1 parent 13d8e9d commit 9a3a847

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-validation-unobtrusive",
3-
"version": "3.2.2",
3+
"version": "3.2.3",
44
"homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
55
"description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
66
"main": [

jquery.validate.unobtrusive.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,19 @@
8585
}
8686

8787
function onReset(event) { // 'this' is the form element
88-
var $form = $(this);
89-
$form.data("validator").resetForm();
88+
var $form = $(this),
89+
key = '__jquery_unobtrusive_validation_form_reset';
90+
if ($form.data(key)) {
91+
return;
92+
}
93+
// Set a flag that indicates we're currently resetting the form.
94+
$form.data(key, true);
95+
try {
96+
$form.data("validator").resetForm();
97+
} finally {
98+
$form.removeData(key);
99+
}
100+
90101
$form.find(".validation-summary-errors")
91102
.addClass("validation-summary-valid")
92103
.removeClass("validation-summary-errors");
@@ -372,7 +383,15 @@
372383
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
373384
var paramName = appendModelPrefix(fieldName, prefix);
374385
value.data[paramName] = function () {
375-
return $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']").val();
386+
var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
387+
// For checkboxes and radio buttons, only pick up values from checked fields.
388+
if (field.is(":checkbox")) {
389+
return field.filter(":checked").val() || field.filter(":hidden").val() || '';
390+
}
391+
else if (field.is(":radio")) {
392+
return field.filter(":checked").val() || '';
393+
}
394+
return field.val();
376395
};
377396
});
378397

jquery.validate.unobtrusive.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.

0 commit comments

Comments
 (0)