diff --git a/public/scripts/manage/game.js b/public/scripts/manage/game.js index 9b0e86e..5d0bd29 100644 --- a/public/scripts/manage/game.js +++ b/public/scripts/manage/game.js @@ -12,6 +12,7 @@ const team1Dropdown = document.getElementById('team1-dropdown'); const team2Dropdown = document.getElementById('team2-dropdown'); const team1ScoreTextbox = document.getElementById('team1-score-textbox'); const team2ScoreTextbox = document.getElementById('team2-score-textbox'); +const nameTextbox = document.getElementById('name-textbox'); const submitButton = document.getElementById('submit-button'); const deleteButton = document.getElementById('delete-button'); @@ -70,6 +71,9 @@ async function initializeForm() { team2Dropdown.disabled = false; team1ScoreTextbox.disabled = false; team2ScoreTextbox.disabled = false; + if(nameTextbox) { + nameTextbox.disabled = false; + } sportDropdown.onchange = async () => { await Form.populateGenders(genderDropdown, sportDropdown.value) @@ -89,6 +93,7 @@ async function initializeForm() { team1ScoreTextbox.addEventListener('keyup', checkDataValidity); team2Dropdown.onchange = checkDataValidity; team2ScoreTextbox.addEventListener('keyup', checkDataValidity); + if(nameTextbox) nameTextbox.addEventListener('keyup', checkDataValidity); checkDataValidity(); } @@ -112,6 +117,8 @@ async function checkDataValidity() { if(dateInput.value == "") dataIsValid = false; + if(nameTextbox && nameTextbox.value == "") dataIsValid = false; + submitButton.disabled = !dataIsValid; } diff --git a/views/manage/addgame.pug b/views/manage/addgame.pug index 69bd3c0..bdc362c 100644 --- a/views/manage/addgame.pug +++ b/views/manage/addgame.pug @@ -49,7 +49,7 @@ block content span(class='form-section') label Your name span(class='form-section-input') - input#name-input(type="text" name="name" disabled) + input#name-textbox(type="text" name="name" disabled) .error #{message} span(class='form-section') button#submit-button(type="submit" disabled) Submit