MooTools FormCheck 功能完善的表单验证插件 »
FormCheck是一个MooTools类,允许您执行不同的形式测试,以验证表单上他们之前提交数据的有效性。它现在版本已经是1.6了。支持通过CSS自定义外观,将校验提示信息以Tips的方式显示。FormCheck除了支持一些常用的校验包括:必填校验,数字校验,长度校验等。还支持表达式校验包括:电话号码、Email、URL等。国际化的支持,现在支持10种不同的语言
,最重要的是他们提供了完整的API使用说明和不同类型的验证实例 (Forum registration, Registration, User login,Support,Post comment,Simple check,Number range
)。

Features:
- Lightweight, shiny and fast
- Skins support : customize css, fonts, …
- Cross-browser compatibibility
- Display errors as tips, or before/after the field
- Basic validation (required, alpha, digit, alphanu, length, confirm, …)
- Regex validation (phone, email, url)
- Custom function based validation, to perform test that could not be handled by basic tests neither regex test.
- Make easily your own custom regex and alerts
- Internalization : we now support 10 different languages
- Active community
- A lot of options that allow you to customize this class to fit exactly as you want
如何使用
Attach FormCheck to your HTML document
1 2 | <script type="text/javascript" src="/js/formcheck/lang/en.js"> </script> <script type="text/javascript" src="/js/formcheck/formcheck.js"> </script> |
Link the desired theme
1 | <link rel="stylesheet" href="/js/formcheck/theme/classic/formcheck.css" type="text/css" media="screen" /> |
Instantiate FormCheck class for the given form
1 2 3 4 5 | <script type="text/javascript"> window.addEvent('domready', function(){ new FormCheck('myform'); }); </script> |
使用起来是如此的简单,如果想了解更多请点击如下相应链接: