Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ppl,

What are the recommended field validations for validating user input?
I know the question is broad... Looking for a starting list. Things like, sql injection, removing funny characters (not people) etc...

I understand the basic checks just want to know if there is a good list out there of things to watch out for.

Thanks
Ash
Posted

1 solution

You can add few basic validation methods to your UI control.

ValueMissing - returns true if a required element is empty.
TypeMismatch - This value applies to all the new type attributes. For example, if an email value is incorrect, this attribute returns true.
PatternMismatch - When an element contains the pattern attribute and doesn’t conform to the regular expression conditions, this attribute will return true.
TooLong - When any element surpasses its maxlength property this attribute will return true.
Rangeflow - If an element’s min or max attributes are above or below the specified values, this attribute will return true.
StepMismatch- When an element with the step attribute doesn’t conform to the required step value, this attribute returns true.
Valid - If any of the values listed above return true, this attribute returns false to indicate the field is invalid. Otherwise, if all the conditions
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900