Add check validity function for add season page
parent
150a186aea
commit
644c8fdec3
|
@ -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);
|
|
@ -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")
|
Reference in New Issue