Complete addition of name textbox to game submit form

main
sudoer777 2021-12-06 11:43:30 -07:00
parent a113b1ee38
commit ac30b71b48
2 changed files with 8 additions and 1 deletions

View File

@ -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;
}

View File

@ -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