Expand my Community achievements bar.

Adding Prepopulated dates to a HeaderRow

Avatar

Level 4

I am having problems adding some prepopulated dates to the HeadRow of a Table. Is there somewhere for me to post my form for assistance?

2 Replies

Avatar

Level 3

could you describe your problem in a little more detail?


Are you trying to populate these dates with scripts? Where are the dates coming from?

Avatar

Level 4

Dates populate fine without them being in the HeaderRow it is not until I put them into the HeaderRow that it becomes a problem

Below is the code: ( the are named - Dates[0] Dates[1] Dates[2] Dates[3] Dates[4] Dates[5] Dates[6] etc. - dates span a two week period)

//comment();

/*

if (event.changeEx != "" && event.changeEx != "Pay Period") {

fillFields(event.changeEx,2008);

}

*/

var

strSelection = this.formattedValue;

var

strStartDate = strSelection.substr(3,10);

//app.alert(strStartDate)

//Create a new Date object for startDate

var

startDate = new Date(strStartDate);

//populate Day 1 note that the month is return as a value between 0-11 so we must add 1 to it to get the right month

Dates.rawValue

= (parseInt(startDate.getMonth()) + 1) + "/" + startDate.getDate();

//create a constant that represents 1 day in milliseconds

var

oneDay = 24*60*60*1000;

for

(i=1; i<14; i++){

//get the current date as a number of milliseconds and add one day to it

//app.alert("Before adding a day: " + (parseInt(startDate.getMonth()) + 1) + "/" + startDate.getDate());

//app.alert("the number of seconds is: " + (startDate.getTime()/1000));

var startDateMS = startDate.getTime() + oneDay;

//app.alert("After - the number of seconds is: " + (startDateMS/1000));

//set the new date to the var startDate

startDate.setTime(startDateMS);

//app.alert("After adding a day: " + (parseInt(startDate.getMonth()) + 1) + "/" + startDate.getDate());

//set the month and day into the appropriate field

xfa.resolveNode("Dates["

+ i + "]").rawValue = (parseInt(startDate.getMonth()) + 1) + "/" + startDate.getDate();

}