Help with validation syntax [variable]
Posted: Sun Mar 25, 2007 12:30 am
Hey all,
I need to write [variable] into validation code where the variable is a number being incremented by a loop. The braces are not being used an array, so i'm probably breaking some syntax code.. Can this be done? The following code errors :
Error: syntax error
var myindex=document.forms[0].driverType[(+validateCount+)].selectedIndex;
If I write my variable directly
It tells me that
Does anyone have any suggestions?
tia, Will
I need to write [variable] into validation code where the variable is a number being incremented by a loop. The braces are not being used an array, so i'm probably breaking some syntax code.. Can this be done? The following code errors :
Error: syntax error
var myindex=document.forms[0].driverType[(+validateCount+)].selectedIndex;
Code: Select all
var validateCount = 0;
function checkForm() {
var myindex=document.forms[0].driverType[(+validateCount+)].selectedIndex;
if (myindex == "") {
alert("\n You must make a selection from the drop-down menu.");
return false;
}
}Code: Select all
var myindex=document.forms[0].driverType[0].selectedIndex;Code: Select all
Error: document.forms[0].driverType has no propertiestia, Will