Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete space in long textarea wrapped entry

    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:
    Code:
    http://myserver/long/long/longlonglongurlhere/here_ page.cfm
    The database value shows no space:
    Code:
    http://myserver/long/long/longlonglongurlhere/here_page.cfm
    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?
    Code:
    function spaceDel(myobj)
    {
         myobj.value = myobj.value.replace(/\r/g, '');
    }

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,919
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •