# SMValidator **Repository Path**: ulia/SMValidator ## Basic Information - **Project Name**: SMValidator - **Description**: a simple but powerful tool for validating form fields. support bootstrap and your own styles. - **Primary Language**: HTML - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-06-09 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SMValidator(strong muscle validator) ## Features - Light weight - No dependencies - Customizable rules messages and styles - Support bootstrap and semantic - Useable RegExp on html - Support IE8+ ## Tutor And Documents - [中文版教程](https://wldragon.github.io/SMValidator/tutor/tutor1.html) - [快速开始](https://github.com/WLDragon/SMValidator/wiki/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B) ## Preview - **Required** (required rule in html) ``` html ``` - **RegExp** (using RegExp in html) ``` html ``` - **Your Style** (add .fail-error on input when validate failed) ``` html ``` - **Javascript** (use only js without data-rule) ``` javascript new SMValidator('form', { rules: { //define a rule by RegExp onlyNumber: [/^-?\d+(\.{1}\d+)?$/, 'Please input letters'], //define a rule by Function greater: function(val, num) { return (val*1 > num*1) || 'Please input a number that greater than ' + num; } }, fields: { //fieldName1 match input's name fieldName1: { required: true, rule: 'onlyNumber|greater(10)', failCss: 'fail-error' } } }); ``` ## Demos - [A complex demo](https://wldragon.github.io/SMValidator/) - Support third-party UI framework
bootstrap demo semantic demo
## Install - ```npm install --save SMValidator``` - ```bower install SMValidator``` ## Notice - checkbox invalid in IE8 - `