基本现场验证 [英] Basic field validations

查看:60
本文介绍了基本现场验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨ppl,

建议使用哪些字段验证来验证用户输入?
我知道问题很广泛...正在寻找开始清单.诸如sql注入,删除有趣的字符(不是人)之类的东西...

我了解基本检查,只是想知道是否有一个不错的清单可供您注意.

谢谢
Ash

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

推荐答案

您可以向UI控件添加一些基本的验证方法.

ValueMissing-如果必需元素为空,则返回true.
TypeMismatch-此值适用于所有新的类型属性.例如,如果电子邮件值不正确,则此属性返回true.
PatternMismatch-当元素包含pattern属性并且不符合正则表达式条件时,此属性将返回true.
TooLong-当任何元素超过其maxlength属性时,此属性将返回true.
Rangeflow-如果元素的min或max属性高于或低于指定值,则此属性将返回true.
StepMismatch-当具有step属性的元素不符合所需的step值时,此属性返回true.
有效-如果上面列出的任何值返回true,则此属性返回false以指示该字段无效.否则,如果满足所有条件
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


这篇关于基本现场验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆