简体   繁体   English

我如何查看Jquery中是否已完成内联Ajax验证

[英]How do i see Whether The inline ajax validation has been done or not in Jquery

Iam using this Form plugin to perfom inline ajax validation and form validation http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ Iam使用此Form插件执行内联Ajax验证和表单验证http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/

I have a textfield say student number for that text field which will inline validate whether stuno exists or not we have in the jqueryvalidationengine-en.js 我有一个文本字段说该文本字段的学生编号,它将内联验证jqueryvalidationengine-en.js中是否存在stuno

"ajaxstudent":{
"file":"student.php",
"alertText":"* SNO is already taken",
"alertTextOk":"", 
"alertTextLoad":"* Checking..."},
$('#submitbutton').click(function(){    
if ($("#form1").validationEngine({returnIsValid:true})) {

}       

Now my Problem How do i see that inline ajax validation is done before the form submit.Due to this iam getting Debug error.Iam able to submit the form even when the Student number exists This results in Creation of same Student numbers .How can i overcome this 现在我的问题我怎么看到在提交表单之前已经完成了内联ajax验证。由于此iam收到Debug错误。即使学生编号存在,我也能够提交表格,这导致创建相同的学生编号。克服这个

You need to attach the validation engine when the page loads. 页面加载时,您需要附加验证引擎。 Not when the form is submitted to see inline validation. 提交表单时看不到内联验证。

$(function() { // onready
   $("#formID").validationEngine() // add validation
});

Use the jquery.ajax complete option 使用jquery.ajax complete选项

Read here http://api.jquery.com/jQuery.ajax/ 在这里阅读http://api.jquery.com/jQuery.ajax/

Use that complete option to enable the submit button, or even better use the success option. 使用完整选项启用提交按钮,甚至更好地使用成功选项。 You do not take advantage of either option. 您不会利用这两个选项。

I would provide more code but I do not have a lot to work with ;) 我会提供更多代码,但是我没有太多工作要用;)

Hope this helps at least. 希望这至少可以有所帮助。

Jquery form validation engine plugin submits the form when it gets some error without validating the fields. jQuery表单验证引擎插件在收到一些错误时将提交表单,而无需验证字段。 Use firebug to find out if there is some javascript error and check the ajax request and response to find out the exact cause. 使用firebug找出是否存在一些JavaScript错误,然后检查ajax请求和响应以找出确切原因。

It works fine if you have configured it properly. 如果配置正确,它可以正常工作。

您需要禁用“提交”按钮,直到看到所有字段均已正确输入为止。验证通过后,请编辑“提交”按钮的属性以使其“可单击”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM