Restricting "@, www, http, com, edu, org" from a textarea

Discussion in 'JavaScript' started by Gugel, Apr 3, 2008.

  1. #1
    Hi all,

    I have a text box and I want to prevent users from entering a website, an email address, or a phone number.

    I was thinking I would need to restrict http, www, @, (at), (###), ###-, .com, .edu, .org, .info, .us.
    I know how to restrict a single character, but how do you restrict a string of characters!?

    Thanks so much!
     
    Gugel, Apr 3, 2008 IP
  2. Gugel

    Gugel Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    No posts in this forum for 8 hours!? What gives?
     
    Gugel, Apr 3, 2008 IP
  3. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    in your onsubmit tell use the match function to check for a string.
     
    MMJ, Apr 4, 2008 IP
  4. Gugel

    Gugel Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm kind of a nub and still can't figure it out. Do you mind expanding on what you said a bit?

     
    Gugel, Apr 8, 2008 IP
  5. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    if (*textbox*.value.match('http'))
    alert('error');
     
    MMJ, Apr 8, 2008 IP
  6. Gugel

    Gugel Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks a lot MMJ! Worked great. Now any idea how I can disable a string of numbers -- for example, ###- or (###)?
     
    Gugel, Apr 8, 2008 IP