Use new error handler in UploadCollectionScene

This commit is contained in:
Max Berger
2026-03-09 23:52:34 +01:00
parent 55529f3031
commit d26324e417
2 changed files with 41 additions and 22 deletions

View File

@@ -131,3 +131,18 @@ export function validate_equals(input, target, field_name) {
return "Please type " + target + " in the " + field_name + " field";
};
}
/**
* Validates that at least one file is selected in a file input.
* @param {HTMLInputElement} input
* @param {string} field_name
* @returns {function(): ?string}
*/
export function validate_files(input, field_name) {
return () => {
if (input.files && input.files.length > 0) {
return null;
}
return "Please select at least one " + field_name;
};
}