Click to See Complete Forum and Search --> : Array function....Help!!!


joelo
08-26-2003, 04:51 AM
Please could somebody help me out .....I don't know what I am doing wrong.

function FillDates()
{
for( i = 0; i < document.device.x_TESTDATE.value; i++ )
{
var thedate = document.device.x_TESTDATE[i].value;
document.device.PRE_idTESTDATE[i].value = thedate;
document.device.TUE_idTESTDATE[i].value = thedate;
document.device.SUN_idTESTDATE[i].value = thedate;
document.device.MON_idTESTDATE[i].value = thedate;
}
return true;
}



I keep getting the following error message:

Line: 90
error: 'document.device.x_TESTDATE[...].value is null or not and object

line: 90 is
var thedate=document.device.x_TESTDATE[i].value;


Please any help will do

Thanx.

Gollum
08-26-2003, 05:28 AM
If document.device.x_TESTDATE is an array, then you should probably use document.device.x_TESTDATE.length as the comparison in your loop:

for( i = 0; i < document.device.x_TESTDATE.length; i++ )

joelo
08-26-2003, 05:47 AM
Thanx for response,

Tried it, Nomore errors........but it's not passing the datevalues to the values

This is what I have currently... I still don't know what's wrong

function FillDates() {
for(i=0; i<document.device.x_TESTDATE.length; i++){
var thedate=document.device.x_TESTDATE[i].value;
document.device.PRE_idTESTDATE[i].value=thedate;
document.device.TUE_idTESTDATE[i].value=thedate;
document.device.SUN_idTESTDATE[i].value=thedate;
document.device.MON_idTESTDATE[i].value=thedate;
}
return true;
}

<input type="text" name="x_TESTDATE" value="<%= x_TESTDATE %>" size=15 maxlength=50 onChange="FillDates()">