In my webpage, I'm trying to incorporate a JavaScript calendar, then when the user selects a month and year (through a drop down), rows are created for each day OF that month in a table. These rows would then have Text Input boxes next to them allowing only numeric values. Validation isn't the issue, it's creating the rows for each day of that month.
This can be done using Javascript. Create a method for determining the number of days in a month: (1 = January, 2 = February...)
function daysInMonth(month, year) {
return new Date(year, month, 0).getDate();
}
When the year and the month is selected in the dropdowns, run a loop which adds one table row for every day of the month.
var year = document.myForm.listYear.value; // Value of year dropdown (ex 2012).
var month = document.myForm.listMonth.value; // Value of month dropdown (1-12).
var table = document.getElementById('myTable'); // Table element.
var numDays = daysInMonth(month, year);
for(var i = 0; i < numDays; i++) {
table.innerHTML += '<tr><td>' + (i+1) + '</td><td><input type="text" name="day[]" /></td></tr>';
}