简体   繁体   中英

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/

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

"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

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

Read here 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. Use firebug to find out if there is some javascript error and check the ajax request and response to find out the exact cause.

It works fine if you have configured it properly.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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