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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS Character Validation?

    Is there a way to have a CSS class for form fields, that comes up with a validation error if a user enters symbols or characters that are not letters, numbers or underscores; and basically the validation error makes it so they can't submit the form. Essentially a validation class to block characters that would be used in injection or XSS.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by phpinfo() View Post
    Is there a way to have a CSS class for form fields, that comes up with a validation error if a user enters symbols or characters that are not letters, numbers or underscores; and basically the validation error makes it so they can't submit the form. Essentially a validation class to block characters that would be used in injection or XSS.
    no with css, as far I know.
    you can use html accept-charset attribute:

    http://www.w3.org/TR/html4/interact/...accept-charset

    to restrict encoding, link is for html 4, see specs you need, and use javascript or server side scripts to filter further.

    best regards

  • #3
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    You're looking too far into CSS.

    CSS is for presentation.
    HTML is for structure.
    JavaScript is for, well, scripting.

    You need scripting.


  •  

    Posting Permissions

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