Skip to content

Commit

Permalink
Merge pull request #320 from petterip/main
Browse files Browse the repository at this point in the history
fix: only validate required input fields
  • Loading branch information
tphakala authored Nov 16, 2024
2 parents ce17437 + 081ea7c commit f7b378a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions views/settings/settingsBase.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@
}, 5000);
},
isFormValid(form) {
const visibleFieldsValid = Array.from(form.elements)
.filter(element => element.offsetParent !== null)
.every(element => element.checkValidity());
const inputSelector = 'input[type=\'password\'][required], input[type=\'text\'][required]';
const requiredFields = form.querySelectorAll(inputSelector);
const visibleFieldsValid = Array.from(requiredFields)
.filter(element => element.offsetParent !== null)
.every(element => element.checkValidity());
const inputSelector = 'input[type=\'password\'], input[type=\'text\']';
if(!visibleFieldsValid) {
form.querySelectorAll(inputSelector).forEach(input => {
requiredFields.forEach(input => {
if (input.offsetParent === null) return;
input.checkValidity();
Expand Down

0 comments on commit f7b378a

Please sign in to comment.