emkay717
04-20-2009, 01:19 AM
I am trying to validate a form. In one case at least one of 4 fields must have a value. I have an isBlank() function that determines if a field is blank. Now I want to test all 4 and throw up an error if they are all blank. Here is what I have ...
function isBlank(str)
{
if (str != null)
{
for (i=0;i<str.length;i++)
{
if (str.charCodeAt(i) >= 33)
return false;
}
}
return true;
}
if ((isBlank(txtEvent1.value)) && isBlank(txtEvent2.value)) && isBlank(txtEvent3.value)) && isBlank(txtEvent4.value)))
sErr += 'You must enter at least one ticketing event.\n'
I have tried adding & removing parentheses .. I can't figure out the syntax error. Thanks for any help!
function isBlank(str)
{
if (str != null)
{
for (i=0;i<str.length;i++)
{
if (str.charCodeAt(i) >= 33)
return false;
}
}
return true;
}
if ((isBlank(txtEvent1.value)) && isBlank(txtEvent2.value)) && isBlank(txtEvent3.value)) && isBlank(txtEvent4.value)))
sErr += 'You must enter at least one ticketing event.\n'
I have tried adding & removing parentheses .. I can't figure out the syntax error. Thanks for any help!