SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Links in Forms

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Links in Forms

    How can I block people from putting links in my text field and textareas?
    Are there any tutorials out there for this?

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to deal with this server-side. Not everyone uses browsers that have JavaScript support enabled.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    code ninja hamstu's Avatar
    Join Date
    Nov 2002
    Location
    Montréal, Canada
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could do checking, and even modification with JavaScript on your inputs. But since JavaScript is easy to turn off, the best solution would be to use a server-side langauge, like PHP, to validate the form.

    For example, to make sure HTML isn't parsed (and therefore, links won't work), try running your text through the PHP function htmlspecialchars.


Bookmarks

Posting Permissions

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