Skip to content

Commit 044fd15

Browse files
committed
#1 fix missed function
1 parent 0fbe212 commit 044fd15

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
.DS_Store
33
.idea/
4-
package-lock.json
4+
package-lock.json
5+
local-test

Diff for: dist/jquery.form-validation.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,19 @@ var Validator = function () {
230230
Validator.prototype.different = function (otherName) {
231231
this.otherName = otherName;
232232
this.triggerOtherName(otherName);
233-
var otherValue = this.$form.serializeArrayKv()[otherName];
233+
var otherValue = this.serializeArrayKv(this.$form)[otherName];
234234
return this.val !== otherValue;
235235
};
236236
Validator.prototype.required_if = function (otherName) {
237237
this.otherName = otherName;
238238
this.triggerOtherName(otherName);
239-
var otherValue = this.$form.serializeArrayKv()[otherName];
239+
var otherValue = this.serializeArrayKv(this.$form)[otherName];
240240
return otherValue ? this.required() : true;
241241
};
242242
Validator.prototype.required_if_val = function (otherName, specificValue) {
243243
this.otherName = otherName;
244244
this.triggerOtherName(otherName);
245-
var otherValue = this.$form.serializeArrayKv()[otherName];
245+
var otherValue = this.serializeArrayKv(this.$form)[otherName];
246246
if (this.valLength(specificValue) && otherValue === specificValue) {
247247
// checked value === other value
248248
return this.required();
@@ -322,7 +322,12 @@ var Validator = function () {
322322
});
323323
return message;
324324
};
325-
325+
Validator.prototype.serializeArrayKv = function ($form) {
326+
var arr = $form.serializeArray(), obj = {};
327+
for (var i = 0; i < arr.length; ++i)
328+
obj[arr[i].name] = arr[i].value;
329+
return obj;
330+
};
326331
Validator.prototype.language = {
327332
numeric: 'The {label} must be a number.',
328333
integer: 'The {label} must be an integer.',
@@ -344,7 +349,7 @@ var Validator = function () {
344349
in: 'The selected {label} is invalid.',
345350
not_in: 'The selected {label} is invalid.',
346351
different: 'The {label} and {otherLabel} must be different.',
347-
required: 'The {label} field is required..',
352+
required: 'The {label} field is required.',
348353
required_if: 'The {label} field is required when {otherLabel} is filled.',
349354
required_if_val: 'The {label} field is required when {otherLabel} is {param0}',
350355
same: 'The {label} and {otherLabel} must match.',

Diff for: dist/jquery.form-validation.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)