SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Preventing html tags in form submission

    How can I check if a field contains html tags and alert the user instead of submitting the form?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Nelson, NZ
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    server side usually

    This type of checking is ususally done on the server, php has several functions (htmlentities(), htmlspecialchars()) to sanitise user input. I don't think there is anyting in javascript to do it. You could write your own function, I had a quick google without finding anything. Maybe re-post on your server language forum?

    Paul
    Scryptik Javascript editor - with inbuilt syntax error checker

  3. #3
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    javascript can strip tags, but of course malicious user won't submit from the actual page which run javascript


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
  •