View Full Version : Delete space in long textarea wrapped entry

10-17-2006, 09:05 PM
I have a condition on my form update that checks for differences between my form textarea value and the value in my Access 2000 database.

It works 99% of the time but adds a space in the Form value on long url entries such as this:

http://myserver/long/long/longlonglongurlhere/here_ page.cfm

The database value shows no space:


I have the form textarea wrap set to "hard" and if I turn that off or set it to "soft" the space addition goes away but I need the "hard" wrap on.

Please advise a way to correct this problem because I have tried many attempts on the server side but now thinking I should do this with client side using reg expression to eliminate the space but not sure how I can do that?

My attempt needs work because I dont know if I am grabbing the right space or is it a newline issue?

function spaceDel(myobj)
myobj.value = myobj.value.replace(/\r/g, '');

Philip M
10-17-2006, 10:23 PM
function spaceDel(myobj)
myobj.value = myobj.value.replace(/\s+/g, '');

\s matches a single white space character including space, tab, form feed and line feed. \s+ matches 1 or more instances of white space character.