Set selectedMonth and selectedYear from the value attribute of the input element if it is not empty