mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
disable generate button if duration is zero
This commit is contained in:
parent
fd766e7b1a
commit
bd8af153a9
@ -549,6 +549,7 @@ document.getElementById('loginForm').onsubmit = function() {
|
||||
let minutes = document.getElementById('minutes');
|
||||
addOptions(59, minutes);
|
||||
minutes.selected = "30";
|
||||
checkDuration();
|
||||
loginModal.hide();
|
||||
}
|
||||
}
|
||||
@ -958,3 +959,17 @@ document.getElementById('settingsSave').onclick = function() {
|
||||
}
|
||||
}
|
||||
|
||||
// Diable 'Generate' button if days, hours, minutes are all zero
|
||||
function checkDuration() {
|
||||
let boxVals = [document.getElementById("days").value, document.getElementById("hours").value, document.getElementById("minutes").value];
|
||||
let submit = document.getElementById("generateSubmit");
|
||||
if (boxVals[0] != 0 || boxVals[1] != 0 || boxVals[2] != 0) {
|
||||
submit.disabled = false;
|
||||
} else if (boxVals[0] == 0 && boxVals[1] == 0 && boxVals[2] == 0) {
|
||||
submit.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (i of ["days", "hours", "minutes"]) {
|
||||
document.getElementById(i).addEventListener("change", checkDuration);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user