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
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do I validate against consecutive spacebar enteries in text/textarea fields

    I have a form where users are hitting the spacebar to get around validation. Does anyone have validation code to recognize this and stop it? Thank you for any help you can provide.

    FlyFisher

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,029
    Thanks
    203
    Thanked 2,539 Times in 2,517 Posts
    Use a regular expression.

    tmpStr = tmpStr.replace (/(^\s+)/, ""); // remove spaces at start of string


    You can test your regular expressions at: http://www.ogauge.co.uk/regextester.html


  •  

    Posting Permissions

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