if (parseStr(Item1)!= parseStr(Item2)){alert("Problem");}else {alert("Everything is okay");}

Fotiman

3:16 pm on May 16, 2012 (gmt 0)

1. Don't use the language attribute on script tags. It's invalid.

2. Your validateForm method takes a single parameter, ecollection, which is never used. Instead, you're using the string literal "ecollection" everywhere.

3. Item1 and Item2 contain the same values as InvoiceEmail and ValInvoiceEmail, so you don't need Item1 and Item2, just use InvoiceEmail and ValInvoiceEmail.

4. Where is parseStr defined? Also, the validation of CompanyName, AccCode, InvoiceEmail, ValInvoiceEmail, StatementEmail, ValStatementEmail, and CompletedBy will all succeed if the user enters spaces only in the field, which is probably not the desired behavior. That is, you probably want to use this parseStr method on all of those tests as well (assuming parseStr will handle trimming off leading and trailing whitespace). For example:

if (parseStr(CompanyName) == null || parseStr(CompanyName) == "") {

I suspect that parseStr is not defined, and that's what's causing your problem.