验证使用nic validator

  • 更多验证规则请参考
  • 使用JS验证https://niceue.com/validator/demo/custom-rule.php
实例
            
                已经封装好,使用方法和nic validator一样,更多验证要求在 setTheme 配置
                <form id="demo_101" action="results.php" method="post" autocomplete="off" data-validator-option="{theme:'yellow_top'}">
            <fieldset>
              <!-- 定义了mobile规则,并且通过data-rule使用 -->
              <div class="form-group"> <label class="form-control-label" for="FormTree1">
                  <span>标准表单案例</span>
                </label>
                <div class="form-control-wrap">
                    <input name="mobile" class="form-control" placeholder="手机号" data-rule="required; mobile" data-rule-mobile="[/^1[3458]\d{9}$/, '请检查手机号格式']">
                </div>
              </div>

            </fieldset>
            <button type="submit">提交</button>
          </form>