fix: remove required attr from file input when existing video is selected

This commit is contained in:
jetson committed 2026-09-21 10:32:14 +07:00
1 parent d353272a0b
commit 42c80fd0fc
1 file changed
+5 -2
+5 -2
View File
@@ -273,10 +273,8 @@
form.addEventListener('submit', function () {
if (videoPathInput.value) {
form.action = '/upload/reuse';
fileInput.removeAttribute('required');
} else {
form.action = '/upload';
fileInput.setAttribute('required', '');
}
submitBtn.disabled = true;
submitBtn.textContent = 'Starting...';
@@ -292,6 +290,11 @@
submitHint.textContent = enabled
? 'Ready to start analysis.'
: 'Select a video and at least one model to begin.';
if (selectedExistingVideo) {
fileInput.removeAttribute('required');
} else if (fileInput.files && fileInput.files.length === 0) {
fileInput.setAttribute('required', '');
}
}
/* ------------------------------------------------