Code Monkey home page Code Monkey logo

Comments (3)

niceue avatar niceue commented on August 17, 2024

@240638006

//初始化验证
$('#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.

240638006 avatar 240638006 commented on August 17, 2024

//验证器
/*
$('#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
//初始化验证 $('#myFormId').validator(options) //绑定验证成功的事件 .on('valid.form', function(){ //ajax提交 $(this).ajaxSubmit({ url: "ajax.php" }); });

或者
$('#myFormId').validator({ valid: function(form){ $(form).ajaxSubmit({url: "ajax.php"}); } });


Reply to this email directly or view it on GitHub.

from nice-validator.

240638006 avatar 240638006 commented on August 17, 2024

bug

from nice-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.