• jQuery.validationEngine前端验证


    引入相关文件:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js" type="text/
    javascript"></script>
    <script src="js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>

    使用实例:

    邮箱验证:
    <input value="someone@nowhere.com" class="validate[required,custom[email]]" type="text" name="email" id="email" />
    日期验证:
    <input value="2010-12-01" class="validate[required,custom[date]]" type="text" name="date" id="date" />
    数字验证:
    <input value="too many spaces obviously" class="validate[required,custom[onlyLetterNumber]]" type="text" name="special" id="special" />
    URL验证:
    <input value="http://" class="validate[required,custom[url]] text-input" type="text" name="url" id="url" data-prompt-position="topLeft" />
    必填验证:
    <input value="" class="validate[required] text-input" type="text" name="req" id="req" data-prompt-position="bottomLeft" />
    数字字母验证:
    <input value="too many spaces obviously" class="validate[required,custom[onlyLetterNumber]]" type="text" name="special" id="special" data-prompt-position="bottomRight" />
    自定义验证:
    <input value="" class="validate[required,funcCall[checkHELLO]]" type="text" id="lastname" name="lastname" />
    function checkHELLO(){
       alert('Hello World!');  
    }

    AJAX验证:
    <input value="" class="validate[required,custom[onlyLetterNumber],maxSize[20],ajax[ajaxUserCall]] text-input" type="text" name="user" id="user" />
    "ajaxUserCall": {
        "url": "ajaxValidateFieldUser",
        "extraData": "name=eric",
        "extraDataDynamic": ['#user_id', '#user_email'],
        "alertText": "* This user is already taken",
        "alertTextOk": "All good!",
        "alertTextLoad": "* Validating, please wait"
    },
    多选验证:
    <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck1" value="5"/>
    <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck2" value="3"/>
    <input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck3" value="9"/>
  • 相关阅读:
    执行动态sql返回参数
    转: css box-sizing的用法
    使用mocMvc书写测试用例
    sprin-security之二(如何进行连接数据库)
    spring-security学习之(一)出入安全框架
    It's likely that neither a Result Type nor a Result Map was specified
    How To Install Java with Apt-Get on Ubuntu 16.04
    Kafka入门经典教程
    深入理解 Python 异步编程(上)
    ZooKeeper管理分布式环境中的数据
  • 原文地址:https://www.cnblogs.com/fxfly/p/4642239.html
Copyright © 2020-2023  润新知