diff --git a/public/scripts/manage/season.js b/public/scripts/manage/season.js index e69de29..82d0204 100644 --- a/public/scripts/manage/season.js +++ b/public/scripts/manage/season.js @@ -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); diff --git a/views/manage/addseason.pug b/views/manage/addseason.pug index 4050cb2..27783b5 100644 --- a/views/manage/addseason.pug +++ b/views/manage/addseason.pug @@ -9,9 +9,9 @@ block content span(class='form-section') label Ending year 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') - button#submit-button(type="submit") Submit + button#submit-button(type="submit" disabled) Submit block scripts script(src='/scripts/manage/season.js' type="module") \ No newline at end of file