Question
Validating MM/YYYY field for format and that input does not exceed current MM/YYYY
I am trying to create a question with one field for MM/YYYY. I would like to validate the field so it:
1. Only accepts numbers in that format
2. Only accepts 01-12 as inputs for the MM component
3. Does not allow input of any year before 1990
4. Does not allow input of any MM/YYYY that exceeds the current MM/YYYY
Seeking guidance on how to best create this question with this validation.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

!
Problem with this method is validating that MM & YYYY are not in the future, right?
And this is the code I put in that Q's JS. I put "${q://QID7/ChoiceTextEntryValue/1}" and "${q://QID7/ChoiceTextEntryValue/2}" to define the variables:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var MM = document.getElementById("${q://QID7/ChoiceTextEntryValue/1}");
var YYYY = document.getElementById("${q://QID7/ChoiceTextEntryValue/2}");
var date = new Date();
var month = date.getMonth()+1;
var year = date.getYear()+1900;
// Check Month for future state
MM.addEventListener('change', function() {
var MMInput = MM.value;
if (MMInput > month) {
alert("The month entered is in the future. Please enter past/current month");
}
});
// Check Year for future state
YYYY.addEventListener('change', function() {
var YYYYInput = YYYY.value;
if(YYYYInput > year) {
alert("The year entered is in the future. Please enter past/current year")
}
});
});
The validation isn't working - do you know what I'm doing wrong? Thank you!