• Jquery Validation :多个按钮都需要做提交验证的解决方案


    按钮点击时出发validate方法:


    $("#btnQuery").click(function() {
            $(
    "form").validate(validate_settings_query);
    });

     validate_settings_query这个是validate的option参数,那么实现不同的校验逻辑,实际上就是构造不同的option参数即可:

    $(document).ready(function() {
                
    var _customer_query = {
                    rules: {
                        txtCustEmail: {
                            required: 
    true,
                            email: 
    true
                        }
                    }, 
    //end rule
                    messages: {
                        txtCustEmail: {
                            required: 
    "账号不能为空",
                            email: 
    "请录入正确格式的Email地址"
                        }
                    }
    //end message
                };
                      
                
    var _customer_submit = {
                    rules: {
                        txtCustAmount: {
                            required: 
    true
                        }
                    }, 
    //end rule
                    messages: {
                        txtCustAmount: {
                            required: 
    "金额不能为空"
                        }
                    }
    //end message
                };

                
    var validate_settings_query = jQuery.extend({}, _default, _customer_query);
                
    var validate_settings_submit = jQuery.extend({}, _default, _customer_submit);
                
                $(
    "#btnQuery").click(function() {
                    $(
    "form").validate(validate_settings_query);
                });

                $(
    "#btnSubmit").click(function() {
                    $(
    "form").validate(validate_settings_submit);
                });
                
            });
  • 相关阅读:
    从源码角度看MySQL memcached plugin——3. containers表的管理
    从源码角度看MySQL memcached plugin——2. 线程模型和连接的状态机
    从源码角度看MySQL memcached plugin——1. 系统结构和引擎初始化
    从源码角度看MySQL memcached plugin——0.大纲
    关注博客
    文摘
    MySQL—FTS实现原理介绍PPT
    GIT情况展示说明
    final发布48小时用户调查报告
    final版本发布评价II
  • 原文地址:https://www.cnblogs.com/Cheese_Ren/p/1447166.html
Copyright © 2020-2023  润新知