Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty forms #105

Merged
merged 3 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading