...

View Full Version : CSS Character Validation?



phpinfo()
02-09-2008, 06:10 AM
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.

oesxyl
02-09-2008, 06:27 AM
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/forms.html#adef-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

Apostropartheid
02-09-2008, 05:06 PM
You're looking too far into CSS.

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

You need scripting.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum