form validation problem
I'm trying to check for zero length strings entered into a <textarea> element
(using vbscript in ASP).
if body = "" then...
if len(body)=0 then...
(The var "body" comes from a textarea in my form.)
Now either of these methods work fine for checking whether "title" is a zero
length string. But then "title" comes from a <input type=text>, not a <textarea>
Can anyone help, please..?
Re: form validation problem
"LucyG" <firstname.lastname@example.org> wrote in message
> I'm trying to check for zero length strings entered into a
> (using vbscript in ASP).
When checking for zero length strings, always remember to trim
leading and trailing spaces first since the space character will
count as being part of the string.
strTest = " "
Len(strTest) 'Returns 1
'With leading and trailing spaces trimmed:
Len(Trim(strTest)) 'Returns 0
Hope this helps!
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL