I have an set of 12 fields that populate months.
The first field (Month 1) is populated with the first month.
The second (Month 2) field contains the script (below) that populates itself and the remaining fields with the remaining months.
There is a separate field (NumberMonths) which caculates how many months should be populated. How can I revised the second field script to only populate a certain number of months while leaving (or changing if already populated with a previous entry) the remaining fields to blank.
For example, if "NumberMonths" is 5 and "Month 1" is May, then I only need June, July, August, and September to populate the next 4 fields and the remaining fields to be blank.
Thanks for your help!
"Month 2" Script:
var sInputMonth = getField("Month 1").value;
var aMonths = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var iStartMonth = aMonths.indexOf(sInputMonth);
if(iStartMonth < 0) {
app.alert("Error! Invalid Month.");
}
else {
var y = 2;
var x = iStartMonth + 1;
while(x != iStartMonth) {
if(x > 11)
x = 0;
else {
getField("Month " + y.toString()).value = aMonths[x];
y++;
x++;
}
}
}
George Kaiser