mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14: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;
|
const winType = winTypeSelect.value;
|
||||||
|
|
||||||
if (winType === "Pin") {
|
if (winType === "Pin") {
|
||||||
if (
|
// Clear existing validation state and stored scores
|
||||||
dynamicScoreInput.querySelector("#minutes") &&
|
|
||||||
dynamicScoreInput.querySelector("#seconds")
|
|
||||||
) {
|
|
||||||
validateForm(); // Trigger validation
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear existing form and create Pin inputs
|
|
||||||
dynamicScoreInput.innerHTML = "";
|
dynamicScoreInput.innerHTML = "";
|
||||||
pinTimeTip.style.display = "block";
|
pinTimeTip.style.display = "block";
|
||||||
|
|
||||||
@@ -38,8 +30,9 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
dynamicScoreInput.appendChild(secondInput);
|
dynamicScoreInput.appendChild(secondInput);
|
||||||
|
|
||||||
const updateFinalScore = () => {
|
const updateFinalScore = () => {
|
||||||
const minutes = minuteInput.value.padStart(2, "0");
|
// Ensure inputs are defined and have valid values
|
||||||
const seconds = secondInput.value.padStart(2, "0");
|
const minutes = (minuteInput.value || "0").padStart(2, "0");
|
||||||
|
const seconds = (secondInput.value || "0").padStart(2, "0");
|
||||||
finalScoreField.value = `${minutes}:${seconds}`;
|
finalScoreField.value = `${minutes}:${seconds}`;
|
||||||
validateForm();
|
validateForm();
|
||||||
};
|
};
|
||||||
@@ -48,6 +41,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
input.addEventListener("input", updateFinalScore);
|
input.addEventListener("input", updateFinalScore);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Safely initialize the final score
|
||||||
updateFinalScore(); // Set initial value
|
updateFinalScore(); // Set initial value
|
||||||
validateForm(); // Trigger validation
|
validateForm(); // Trigger validation
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user