jQuery.validate 表单动态验证

jquery 动态处理页面中input 非空验证,和部分格式验证信息 /** * 给引用页面动态添加验证事件 * 案例:<div class="col-sm-8"> <label>及格分数</label> <input type="text" id="PassScore" mstype="1" msg="及格分数" fmt="float"> <span>分</span> </div> * 解释:input id 为必有项, mstype="1":标识该输入框为需要校验 msg="及格分数" msg:标识这个文本框需要输入的内容名称 fmt="float" * fmt 标识校验数据类型的格式,目前支持 int 整型 ; float: 小数; mobile:手机号格式校验;email:格式校验; * 前台展示后代码为 * <div class="col-sm-8"> <label>及格分数</label> <input type="text" id="PassScore" mstype="1" msg="及格分数" fmt="float"> <span>分</span> <div name='error'><span style='color: Red;font-size: 12px;'><i class='fa fa-info-circle'></i>几个分数不能为空</span></div> </div> * checkallStr() 校验页面中所有标识的输入框信息 使用场景 是 * msginfo(objid,objmess) 校验非空信息提示 #B0B0B0 灰色色值 * errinfo(objid,objmess) 校验格式错误信息提示 RED 红色色值 */ 立即下载
实际上jQuery.validate提供了动态校验的方法。而动态拼JSON串的方式是不支持动态校验的。牺牲jQuery.validate的性能优化可以实现(jQuery.validate的性能优化见图1.2 jQuery.validate源码)。
也可以选择使用jQuery.validate提供的动态校验方法。

图1.1 需要校验的HTML页面
js文件内容如下:
var oTab = document.getElementById('addAppDetailTab');
//获取表格的行数
var id = oTab != null ? oTab.tBodies[0].rows.length : 0;
$(function() {
//点击添加,为表格追加一行
    $('#addAppDetailBtn').click(function () {
        var oTr = document.createElement('tr');
        var oTd = document.createElement('td');
        oTd.appendChild(oTr);
        oTab.appendChild(oTr);
        createTD(oTab);
    });
});
//为表格追加一行的方法
function createTD(oTab) {
    //var id = $('#addAppDetailTab').attr('tabTrIndex');
    //id = id ? id : 1;
    $('#addAppDetailTab').attr('tabTrIndex', id);
    var oTr = document.createElement('tr');
    var oTd = document.createElement('td');
    oTd.innerHTML = '<div class="td validation-box"><input class="form-control" style="width:70px" value="" id="appDetailVOList[' + id + '].version" name="appDetailVOList[' + id + '].version"></div>';
    oTr.appendChild(oTd);
     
    var oTd = document.createElement('td');
    oTd.innerHTML = '<div class="td validation-box"><input class="form-control" style="width:120px" onclick="WdatePicker({skin:\'mag\',dateFmt:\'yyyy-MM-dd HH:mm:ss\'})" value="" id="appDetailVOList[' + id + '].updateTime" name="appDetailVOList[' + id + '].updateTime"></div>';
    oTr.appendChild(oTd);
     
    var oTd = document.createElement('td');
    oTd.innerHTML = '<div class="td validation-box"><input class="form-control wdate" style="width:50px" value="" name="appDetailVOList[' + id + '].appSize"><span>MB</span></div>';
    oTr.appendChild(oTd);
     
    var oTd = document.createElement('td');
    //添加beetl表达式
    var copy = $('#platformListDiv').clone();
    copy.find(".select-text").attr("id", "appDetailVOList[" + id + "].platform");
    copy.find(".select-text").attr("name", "appDetailVOList[" + id + "].platform");
     
    copy.appendTo(oTd);
    oTr.appendChild(oTd);
     
    var oTd = document.createElement('td');
    oTd.innerHTML = '<div class="td validation-box"><input class="form-control" style="width:200px" value="" name="appDetailVOList[' + id + '].url"></div>';
    oTr.appendChild(oTd);
     
     
    var oTd = document.createElement('td');
    oTd.innerHTML = '<div class="td"><a href="javascript:;" id="deleteAppVersion_' + id + '" name="deleteAppVersion_' + id + '">删除</a></div>';
    oTr.appendChild(oTd);
     
    oTd.getElementsByTagName('a')[0].onclick = function() {
        var appNum = oTab != null ? oTab.tBodies[0].rows.length : 0;
        var id = $(this).attr('id');
        var trIndex = id.substring(id.indexOf('_') + 1, id.length);
        $('#addAppDetailTab').attr('tabTrIndex', trIndex);
        if (appNum >= 2) {
            oTab.tBodies[0].removeChild(this.parentNode.parentNode.parentNode);
        } else {
            $(this).parent().addClass('validation-box');
            $(this).after(getValidShowErrorHtml("必须填写一行APP版本信息", $(this).attr('name')));
        }
        $('#addAppDetailBtn').show();
    }
    oTab.tBodies[0].appendChild(oTr);
    id ++;
}
 
//保存表单信息的方法
function save() {
    doAppValidate('app_submit_form');
  var flag = $("#app_submit_form").valid(); 
  if(!flag){
        return;
  }
 var dataArray = formArrayUtil($("#app_submit_form").serializeArray())[0];
 console.log(dataArray);
}
 
 
/**
 * 校验  
 * @param formid
 */
/**
 * desc:特殊字符验证
 */
jQuery.validator.addMethod("specialCharValidate", function(value, element, param) {
    var pattern = new RegExp("[`~!@%#$^&*()=|{}':;', \\[\\]<>/? \\.;:%……+¥()【】‘”“'。,、?]"); 
    return this.optional(element)||!pattern.test(value) ; 
}, "请不要输入特殊字符");
 
jQuery.validator.addMethod("positiveNumValidate", function(value, element, param) {
    var strRegex = "^[0-9]+(.[0-9]{2}|.[0-9])?$";
    var pattern = new RegExp(strRegex);
    if (value != "") {
        if (!pattern.test(value)) {
            return false;
        }
    }
    return true;
}, "请输入正数(小数或整数)");
 
 
var rules4Volidate = {
    name : {
        required : true,
        maxlength : 24
    },
    icon : {
        required : true,
        maxlength : 100
    },
    desc : {
        required : true,
        maxlength : 100
    },
    author : {
        required : true,
        maxlength : 24
    },
    email : {
        required : true,
        email : true
    },
    webUrl : {
        maxlength : 100,
        url : true
    },
    reqdata : {
        required : true
    },
    jcaptchaCode : {
        required : true
    }
};
 
var messages4Volidate = {
    name : {
        required : "请输入应用名称",
        maxlength : "名称长度不能超过24个字符"
    },
    icon : {
        required : "请选择应用图标",
    },
    desc : {
        required : "请输入应用描述",
        maxlength : "应用描述不能超过100个字符"
    },
    author : {
        required : "请填写开发者"
    },
    email: {
        required : "请填写开发者邮箱",
        email : "请输入正确的email地址"
    },
    webUrl : {
        maxlength : "下载链接不能超过100个字符",
        url : "请输入合法的URL"
    },
    reqdata : {
        required : "请填写所用数据"
    },
    jcaptchaCode : {
        required : "请填写验证码"
    }
};
 
//动态改变rules4Volidate(JSON格式) 的值
function getRules(formid) {
    if ($("#" + formid).find("tr").length > 0) {
        // 开始逐行验证
        $("#" + formid).find("tr").each(
            function (index, tr) {
                $(this).find("input").each(function() {
                    var nameValue = $(this).attr('name');
                     
                    var idValue = this;
                    if (nameValue.indexOf("].version") != -1) {
                        rules4Volidate[nameValue] = {required : true, maxlength : 12, positiveNumValidate : true};
 
                        messages4Volidate[nameValue] = {required : "请正确填写APP版本", positiveNumValidate: "请输入正数(小数或整数)"};
                    } else if (nameValue.indexOf("].updateTime") != -1) {
                        rules4Volidate[nameValue] = {required : true};
 
                        messages4Volidate[nameValue] = {required : "请正确填写APP版本"};
                    } else if (nameValue.indexOf("].appSize") != -1) {
                        rules4Volidate[nameValue] = {required : true, maxlength : 6, positiveNumValidate: true};
 
                        messages4Volidate[nameValue] = {required : "请正确填写APP大小", maxlength : "APP大小长度不能超过6位", appSizeValidate: "请输入正数(小数或整数)"};
                    } else if (nameValue.indexOf("].platform") != -1) {
                        rules4Volidate[nameValue] = {required : true};
 
                        messages4Volidate[nameValue] = {required : "请正确填写APP运行平台"};
                    } else if (nameValue.indexOf("].url") != -1) {
                        rules4Volidate[nameValue] = {required : true, maxlength : 100, url : true};
 
                        messages4Volidate[nameValue] = {required : "请正确填写APP下载地址", maxlength : "APP下载地址长度不能超过6位", url : "请输入合法的URL地址"};
                    }
                });
            }
        );
    }
}
 
function doAppValidate(formid){
//获取当前rules4Volidate 的值
    getRules(formid);
/*删除jQuery.volidate上一次表单验证添加的validator数据,不删除的话第二次校验不生效。原因如下图代码*/
    $("#" + formid).removeData("validator");//这个是动态拼串的方式生效的关键
    $("#" + formid).validate({rules : rules4Volidate, messages: messages4Volidate, errorPlacement : validErrorFunction,
        success : validSuccessFunction});
}

图1.2 jQuery.validate源码
jQuery Validate插件验证表单小练 jQuery Validate插件验证表单小练。 立即下载

相关推荐

【Agora 本地录制最全总结- 基于Java SDK】

Agora 本地服务端录制

lizhengze1117的博客 1790

JqueryValidate对动态表单的验证

JqueryValidate 实现动态表单的验证

邢慧鹏的博客 1985

Arm Neoverse CMN-700 SLC内存系统与缓存分区技术解析

现代处理器架构中,缓存一致性协议与内存子系统设计直接影响系统性能。Arm Neoverse CMN-700采用的SLC(System Level Cache)通过16-way组相联设计实现高效数据缓存,其物理地址索引机制支持灵活的way分区配置。在软件可配置内存(OCM)模式下,SLC可作为独立内存空间使用,通过寄存器控制实现模式切换与区域锁定。缓存分区技术则通过请求源分类和way-based分配策略,满足实时性任务与吞吐量场景的不同需求。这些技术在5G基站、边缘计算等低延迟场景中具有重要应用价值,特别是C

weixin_30263073的博客 618

jquery.validate 动态绑定项目校验

jquery.validate 动态绑定项目校验

退休的呆毛 630

AttifyOS 3.0实战:从固件提取到物联网设备安全评估全流程解析

本文详细解析了使用AttifyOS 3.0进行物联网设备安全评估的全流程。从获取D-Link路由器固件开始,到利用其预置的Binwalk等工具完成固件提取、解包Squashfs文件系统,并深入分析Web源码进行初步安全审计。这套集成系统极大简化了环境配置,让研究人员能专注于漏洞挖掘本身,是物联网安全评估的高效工具箱。

ice55的博客 215

gmsv源代码c语言,石器时代ABLua的原理、简介、过程、运用、收发

操作原理(一)服务端:服务器源文件客户端:客户所操作的程序(既是游戏客户端)接口:既是某项功能(例如:鼠标点击,文字发送,战斗,观战,人物动作等)返回的值ABlua:在源代码中添加的整套引擎作为回调接口--lua所实现的功能是基于服务端源码添加的接口由该接口与客户端发送封包实现功能源码里是否有ABlua回调接口?例如:源码里的gmsv/battle.c文件(既是战斗回调文件)以下为简单描述C给予l...

weixin_35223575的博客 2408

jQuery Validate 动态验证

使用jQuery Validate实现动态验证 $(function () { //实现选择框动态验证 $("#addModal select").change(function () { $("#addModal form").validate().element($(this)); }); //实现input动态验证 $("#ad...

LitongZero的博客 1659

JS逆向-B站评论数据w_rid参数和wts参数

本文是该专栏的第69篇,后面会持续分享python爬虫干货知识。本文以B站的评论数据为例,通过JS逆向获取其中的w_rid参数以及wts参数生成规律。具体的“逆向”思路逻辑,笔者将会详细介绍每个步骤,并且将在正文结合“完整代码”来详细介绍。废话不多说,具体细节部分以及详细思路逻辑,笔者将在正文结合完整代码进行详细说明。(附带完整代码)

Python进阶专栏《爬虫实战进阶》,《Pyppeteer从入门到精通》原创作者 2049

jQuery.validate 表单校验

jQuery表单验证

m0_57537410的博客 1377

AI之KE:Knowledge Engineering知识工程的简介、发展、应用案例之详细攻略

AI之KE:Knowledge Engineering知识工程的简介、发展、应用案例之详细攻略 目录 Knowledge Engineering知识工程的简介 0.1、What 0.2、How 0.3、Why 1、知识工程过程的5个活动 2、知识图谱的应用 Knowledge Engineering知识工程的发展 1、前知识工程时期——1950-1970时期:图...

头部AI社区如有邀博主AI主题演讲请私信—心比天高,仗剑走天涯,保持热爱,奔赴向梦想!低调,专注,谦虚,自律,反思,成长,还算比较正能量的博主,公益免费传播…内心特别想在AI界做出一些可以推进历史进程影响力的技术(兴趣使然,有点小情怀,也有点使命感呀 5335

RK3588 MPP,RGA,DRM,QT之RGA

RK3588多路视频采用RGA来进行混合成一帧

dreamliweiming的博客 4265

jquery-validate动态添加表单元素后添加动态验证

一.前言 使用jquery-validate时,每次都是把需要验证的表单写死,然后进行验证。但是有些时候,我们需要动态的添加表单元素,然后还需要对这些动态添加的元素进行验证,这个时候就需要动态的去添加一下验证。 二.实现 没有加动态验证之前: // 添加验证 var validator = $("#form").validate({ // ...

guocunlei的博客 5887

Scratch全攻略:从入门到实践的编程之旅

Scratch 是一款由麻省理工学院(MIT)开发的图形化编程工具 ,它诞生的初衷是为了让编程教育更加普及,尤其是让孩子们能够轻松接触和学习编程。与传统的基于文本代码的编程方式不同,Scratch 通过将编程指令以图形化的积木形式呈现,极大地降低了编程的门槛,让编程变得如同搭积木一样简单有趣。

邓邓子的博客 1万+

jquery-validate动态添加表单元素动态验证

index $(function() { $('#testform').validate({ rules:{ name:"required" }

lytlx的专栏 6482

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

jquery.validate 表单验证

 项目使用 jquery.validate.js 对表单进行了验证,jquery.validate 还是很强大的,下面说一些常用的验证   1.项目先要导入js库    &lt;script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.js"&gt;&lt;/script&gt; &...

iteye_18362的博客 178

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

jQuery validate 动态添加校验

jQuery validate rules()function selectChange(value){ $("#inputForm").validate(); if(value=="0"){ $("#endDate").rules("remove", "required"); $("#cost").rules("add", "required");

1551

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

表单验证神器-validate

最近做表单校验提交的功能特别多,之前都是自己写js,再点击提交的时候,满足验证必填,格式,报错以后的提示,跳转到报错处等等需求,最近同事给推荐了一个插件 用来验证表单,十分好用,在以上功能满足的前提下,还可以对表单进行触发校验,失去焦点校验,也可以自动跳转错误等。 插件名:jquery.validate.js 是一个基于jquery的表单验证工具 官网地址:http://jquer...

weixin_30731305的博客 304

jquery validate 插件动态添加删除验证规则

使用jquery validate 表单验证插件的时候,需要做一个动态的添加删除验证规则: 动态添加:$("#id”).rules('add',规则);  如: $("#analysis_content").rules("add",{required:true,messages:{required: "编辑不能为空"}}); 动态删除:$("#id”).rules('r

oneniceman的博客 3956

jquery.validate.js表单验证 jquery.validate.js的用法

jquery.validate.js这个插件已经用了2年多了,是一个不可多得的表单验证最方便快捷的插件。基于jquery的小插件,基本小白一学就会上手,对于项目表单页面比较多,元素比较多的校验,该插件基本分分钟就解决完。 本来想好好总结一下的。暂放demo。 想参考一下这篇楼主的博文。感觉总结的太好了! http://www.cnblogs.com/si-shaohua/p/3780321....

weixin_30846599的博客 172

jquery validate不支持动态生成的表单

jQuery Validate 插件为表单提供了强大的验证功能,让客户端表单验证变得更简单,同时提供了大量的定制选项,满足应用程序各种需求。该插件捆绑了一套有用的验证方法,包括 URL 和电子邮件验证,同时提供了一个用来编写用户自定义方法的 API。 基本用法如下: 一、导入 js 库 &lt;script src="http://XXXXX/jquery-validation-1.14...

习伏众,神巧者不过习者之门 1575

Jquery validate验证表单时多个name相同的元素

if ($.validator) { $.validator.prototype.elements = function () { var validator = this, rulesCache = {}; // select all valid inputs inside the form (no submit or reset butt

oyh1203的专栏 1400

jquery validate 动态增加删除验证规则

页面加载完成初始化form validate  [javascript] view plain copy print? $("#user_regForm").validate({              errorPlacement: function(error, element){                  if(element.attr("

rdman的专栏 2万+

jQuery Validate 表单元素动态校验的使用场景

jQuery Validate 表单元素动态校验的使用场景动态校验场景项目案例需求如图要求处理方法 动态校验场景 前端设计避免不了会出现各种信息校验相关操作,而方便,有效,实时的校验提醒业务也是很好的用户体验,jQuery Validate为表单校验工作提供了很好的开发体验,方便,简洁,满足所有的校验正则以及自定义规则。为表单提供了强大的验证功能,让客户端表单验证变得更简单,同时提供了大量的定制选...

cyadyx的博客 1356

jquery validate 动态生成的多个同名input的验证

我的应用场景是,添加和修改入库单的明细,明细是以表格的形式呈现,可以动态添加商品,用jquery.validate插件做数据验证。 由于jquery.validate插件验证同名的input时只验证第一个,从stackoverflow里看了很多办法,最靠谱的办法还是给同名的input,生成不同的ID,因为这种动态的表单,一般都是人为生成的,所以同名的input赋值不同ID是可行的。 ...

weixin_30791095的博客 638

jQuery UI dialog + jQuery.validate动态对话框实现验证

使用jQuery UI Dialog动态生成一个对话框,使用jQuery.validate是实现验证。 MVC Control代码:         public ActionResult Create()         {             return PartialView();         } MVC View代码 @model NetworkGra

Pipi0714的专栏 6320

Jquery.validate1.19 demo

视频地址 demo <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form id="data-fo...

空 532
上一篇: 拦截器实现分页
下一篇: 如何解决Elasticsearch unassigned shards 问题
aa1bb1cc2
博客等级 码龄16年 4粉丝 24原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值