BigZAJ
12-29-2005, 06:06 AM
I have this code to verify my data fields:
if (document.survey.user.value=='')
{
error = error + ' * User Name';
}
if (document.survey.wkordernumber.value=='')
{
error = error + ' * Work Order #';
}
for(i = 0; i < document.survey.wkordernumber.length; i++)
{
if((document.survey.wkordernumber.charCodeAt(i) >57)||(document.survey.wkordernumber.charCodeAt(i) < 48)
{
error = error + '* Invalid Work Order #';
}
}
if I take out the for loop it works fine, with the for loop none of the checks work. is the loop correct? I am trying to check if the value at the wkordernumer contains any characters that arent numbers. THANKS
if (document.survey.user.value=='')
{
error = error + ' * User Name';
}
if (document.survey.wkordernumber.value=='')
{
error = error + ' * Work Order #';
}
for(i = 0; i < document.survey.wkordernumber.length; i++)
{
if((document.survey.wkordernumber.charCodeAt(i) >57)||(document.survey.wkordernumber.charCodeAt(i) < 48)
{
error = error + '* Invalid Work Order #';
}
}
if I take out the for loop it works fine, with the for loop none of the checks work. is the loop correct? I am trying to check if the value at the wkordernumer contains any characters that arent numbers. THANKS