K Lo
11-21-2003, 04:59 AM
Hi, can anyone tell me what is wrong with the following code:
function ValidateAgainstList(field1){
ListA= GetFieldValue("DisplayStaffinCustomer");
ListAArray = ListA.split("\n");
var maxX = ListAArray.length;
var z;
for (z=0 ; z < maxX ; z++) {
if (field1.toLowerCase() ==
ListAArray[z].toLowerCase() )
{
alert('duplicate')
break;
}
}
}
the value of field1 is Kevin; and the ListA values returned are Kevin;Paul;Steve,
but with this function, i can never get my alert statement?
Is it true that the if condition within a for loop only get executed at the end of the for loop?
anyone has any idea to solve this problem?
Thanks in advance for any help!
function ValidateAgainstList(field1){
ListA= GetFieldValue("DisplayStaffinCustomer");
ListAArray = ListA.split("\n");
var maxX = ListAArray.length;
var z;
for (z=0 ; z < maxX ; z++) {
if (field1.toLowerCase() ==
ListAArray[z].toLowerCase() )
{
alert('duplicate')
break;
}
}
}
the value of field1 is Kevin; and the ListA values returned are Kevin;Paul;Steve,
but with this function, i can never get my alert statement?
Is it true that the if condition within a for loop only get executed at the end of the for loop?
anyone has any idea to solve this problem?
Thanks in advance for any help!