Add check validity function for add season page

main
sudoer777 2021-11-26 14:05:06 -07:00
parent 150a186aea
commit 644c8fdec3
2 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,14 @@
const seasonTextbox = document.getElementById('season-textbox');
const submitButton = document.getElementById('submit-button');
async function checkDataValidity() {
let dataIsValid = true;
if(seasonTextbox.value == "") dataIsValid = false;
submitButton.disabled = !dataIsValid;
}
checkDataValidity();
seasonTextbox.addEventListener('keyup', checkDataValidity);
seasonTextbox.addEventListener('change', checkDataValidity);

View File

@ -9,9 +9,9 @@ block content
span(class='form-section') span(class='form-section')
label Ending year label Ending year
span(class='form-section-input') span(class='form-section-input')
input(type="number", name="year", value=currentYear) input#season-textbox(type="number", name="year", value=currentYear)
span(class='form-section') span(class='form-section')
button#submit-button(type="submit") Submit button#submit-button(type="submit" disabled) Submit
block scripts block scripts
script(src='/scripts/manage/season.js' type="module") script(src='/scripts/manage/season.js' type="module")