Skip to content

Commit

Permalink
Merge pull request #105 from haacked/gh104
Browse files Browse the repository at this point in the history
Handle empty forms
  • Loading branch information
haacked authored Mar 27, 2024
2 parents 38ef69b + d327b65 commit 062c843
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions dist/aspnet-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,10 +611,10 @@ var ValidationService = /** @class */ (function () {
}
var formUID = _this.getElementUID(form);
var formInputUIDs = _this.formInputs[formUID];
var invalidFormInputUIDs = formInputUIDs.filter(function (uid) { return _this.summary[uid]; });
if (invalidFormInputUIDs.length > 0) {
var firstInvalid = _this.elementByUID[invalidFormInputUIDs[0]];
if (firstInvalid) {
var invalidFormInputUID = formInputUIDs === null || formInputUIDs === void 0 ? void 0 : formInputUIDs.find(function (uid) { return _this.summary[uid]; });
if (invalidFormInputUID) {
var firstInvalid = _this.elementByUID[invalidFormInputUID];
if (firstInvalid instanceof HTMLElement) {
firstInvalid.focus();
}
}
Expand All @@ -637,8 +637,8 @@ var ValidationService = /** @class */ (function () {
}
var formUID = _this.getElementUID(form);
var formInputUIDs = _this.formInputs[formUID];
var invalidFormInputUIDs = formInputUIDs.filter(function (uid) { return _this.summary[uid]; });
return invalidFormInputUIDs.length == 0;
var formIsInvalid = (formInputUIDs === null || formInputUIDs === void 0 ? void 0 : formInputUIDs.some(function (uid) { return _this.summary[uid]; })) === true;
return !formIsInvalid;
};
/**
* Returns true if the provided field is currently valid.
Expand Down
Loading

0 comments on commit 062c843

Please sign in to comment.