Title1

Title2

Title3

14-1 表單驗證

一、bootstrapvalidator 官網:https://github.com/nghuuphuoc/bootstrapvalidator

二、使用

  1. 下載 class/bootstrapValidator 至 class/ 底下解壓縮
  2. 引入,在主樣板已有引入,所以在子樣板不必再引入。
    
    <!-- bootstrap 驗證 -->
    <link rel="stylesheet" href="<{$xoAppUrl}>class/bootstrapValidator/css/bootstrapValidator.css"/>
    <script type="text/javascript" src="<{$xoAppUrl}>class/bootstrapValidator/js/bootstrapValidator.js"></script>

     

  3. 調用插件
    
      <script type="text/javascript">
        $(document).ready(function() {
          $('#opForm').bootstrapValidator({
              //live: 'disabled',//
              message: '此值無效',
              feedbackIcons: {
                  valid: 'glyphicon glyphicon-ok',
                  invalid: 'glyphicon glyphicon-remove',
                  validating: 'glyphicon glyphicon-refresh'
              },
              fields: {
                title: {
                  validators: {
                    notEmpty: {
                      message: '必填'
                    }
                  }
                }
              }
          });
        });
      </script>

     

  4. 參數說明