mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-24 17:04:43 +00:00
Fixed matchstats error where putting in a score then changing win type to pin does not unlock the submit button.
This commit is contained in:
@@ -19,15 +19,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
const winType = winTypeSelect.value;
|
||||
|
||||
if (winType === "Pin") {
|
||||
if (
|
||||
dynamicScoreInput.querySelector("#minutes") &&
|
||||
dynamicScoreInput.querySelector("#seconds")
|
||||
) {
|
||||
validateForm(); // Trigger validation
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear existing form and create Pin inputs
|
||||
// Clear existing validation state and stored scores
|
||||
dynamicScoreInput.innerHTML = "";
|
||||
pinTimeTip.style.display = "block";
|
||||
|
||||
@@ -38,8 +30,9 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
dynamicScoreInput.appendChild(secondInput);
|
||||
|
||||
const updateFinalScore = () => {
|
||||
const minutes = minuteInput.value.padStart(2, "0");
|
||||
const seconds = secondInput.value.padStart(2, "0");
|
||||
// Ensure inputs are defined and have valid values
|
||||
const minutes = (minuteInput.value || "0").padStart(2, "0");
|
||||
const seconds = (secondInput.value || "0").padStart(2, "0");
|
||||
finalScoreField.value = `${minutes}:${seconds}`;
|
||||
validateForm();
|
||||
};
|
||||
@@ -48,6 +41,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
input.addEventListener("input", updateFinalScore);
|
||||
});
|
||||
|
||||
// Safely initialize the final score
|
||||
updateFinalScore(); // Set initial value
|
||||
validateForm(); // Trigger validation
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user