Forum Moderators: open

Message Too Old, No Replies

Textarea - validation

It removes my line breaks

         

ASPhopeful

11:03 am on Jul 19, 2004 (gmt 0)

10+ Year Member



Hi All,

I use the following piece of Javascript to validate my text fields and textareas.

-----
function validatedtxt(string) {
for (var i=0, output='', valid="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .,"; i<string.length; i++)
if (valid.indexOf(string.charAt(i))!= -1)
output += string.charAt(i)
return output;
}
-----

The only problems is, it removes line breaks in my textareas. Does anyone know how I can include the line breaks as valid?

Thanks,
ASPhopeful.

ASPhopeful

11:12 am on Jul 19, 2004 (gmt 0)

10+ Year Member



Scrap it. I've added \n and it's included them now.