Comments (3)
//初始化验证
$('#myFormId').validator(options)
//绑定验证成功的事件
.on('valid.form', function(){
//ajax提交
$(this).ajaxSubmit({url: "ajax.php"});
});
或者
$('#myFormId').validator({
valid: function(form){
$(form).ajaxSubmit({url: "ajax.php"});
}
});
from nice-validator.
//验证器
/*
$('#organizationForm').validator({
valid: function(){
//表单验证通过,提交表单到服务器
$('#organizationForm').ajaxSubmit({
url:"${contextPath}/organization/updateOrganization.action",
success: function(data) {
if(data){
DialogUtils.tip("更新组织成功");
parent.DialogUtils.closeDialogById("updateOrganization");
}
}
});
return false;
}
});
*/
$('#organizationForm').validator({valid: function(){return false;}}).on('valid.form', function(){
//ajax提交
$(this).ajaxSubmit({
url:"${contextPath}/organization/updateOrganization.action",
success: function(data) {
if(data){
DialogUtils.tip("更新组织成功");
parent.DialogUtils.closeDialogById("updateOrganization");
}
}
});
});
//提交
$("#updateBtn").click(function(){
$('#organizationForm').submit();
});
我的代码如上:
测试发现问题:
1、页面载入后,在更新页面,如果修改字段并未配置验证规则,点击提交后,发现页面仅作了验证,并未出发事件
2、需要第二次点击,按钮后事件才得到响应。
二在结合jquery.form进行提交后,有时候出现js中错误,
该问题尚未定位
------------------ 原始邮件 ------------------
发件人: "Jony";[email protected];
发送时间: 2013年9月9日(星期一) 晚上11:30
收件人: "niceue/validator"[email protected];
抄送: ""[email protected];
主题: Re: [validator] 如何与jquery.form结合使用? (#31)
@240638006
//初始化验证
或者
—
Reply to this email directly or view it on GitHub.
from nice-validator.
from nice-validator.
Related Issues (20)
- Bug of rule "match" with "display" options (match规则与display同用时的bug)
- input输入框name相同时,提示信息错位。 HOT 2
- 在进行length验证的时候,条件不符合时返回了undefined HOT 1
- 网站打不开问题 HOT 1
- 错误信息显示在同一区域,文本框使用match点击提交按钮会一闪消失
- 使用webpack,npm上是否不是最新的 HOT 1
- 怎样异步验证? HOT 1
- 消息提示位置 HOT 1
- 官网首图挂了,HTTPS貌似是过期了吧
- 相同 name 的多个字段不能只验证一个字段 HOT 5
- 不同iframe,父frame验证子frame的div
- 为什么通过事件更改data-rule无效 HOT 1
- 内置规则怎么设置提示信息。 HOT 1
- remote请求后台无法接收 HOT 1
- 多个input都为空时不给提交,至少填一个才给提交,有没有好法子 HOT 2
- 如果输入的内容包含空格会验证失败
- input type=radio时候 如果name是数组如sku[0] sku[1]存在BUG
- Failed to set a named property on 'HTMLFormElement': Named property setter is not supported.
- 讨论 - nice validator HOT 1
- 讨论 - nice validator HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nice-validator.