0
我使用這個jQuery驗證腳本提交我的形式(或多個),但我需要一些幫助調整它顯示的消息,並再次顯示錶單(提交後)jQuery驗證AJAX提交幫助
http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/
^^的代碼
http://www.position-relative.net/creation/formValidator/demoSubmit.html
^^演示
如果你看一下演示,我希望它顯示綠色的消息,並再次顯示窗體(而不是隱藏它)..我似乎無法弄清楚在腳本中的哪裏來改變它..這是JS代碼片段阿賈克斯提交功能:
submitForm: function (caller) {
if ($.validationEngine.settings.ajaxSubmit) {
$.ajax({
type: "POST",
url: $.validationEngine.settings.ajaxSubmitFile,
async: true,
data: $(caller).serialize(),
beforeSend: function() {
},
success: function (data) {
if (data == "true") { // EVERYTING IS FINE, SHOW SUCCESS MESSAGE
$(caller).css("opacity", 1)
$(caller).animate({
opacity: 0,
height: 0
},
function() {
$(caller).css("display", "none")
$(caller).before("<div class='ajaxSubmit'>" + $.validationEngine.settings.ajaxSubmitMessage + "</div>")
$.validationEngine.closePrompt(".formError", true)
$(".ajaxSubmit").show("slow")
if ($.validationEngine.settings.success) { // AJAX SUCCESS, STOP THE LOCATION UPDATE
$.validationEngine.settings.success && $.validationEngine.settings.success();
return false;
}
})
} else { // HOUSTON WE GOT A PROBLEM (SOMETING IS NOT VALIDATING)
data = eval("(" + data + ")");
errorNumber = data.jsonValidateReturn.length
for (index = 0; index < errorNumber; index++) {
fieldId = data.jsonValidateReturn[index][0];
promptError = data.jsonValidateReturn[index][1];
type = data.jsonValidateReturn[index][2];
$.validationEngine.buildPrompt(fieldId, promptError, type);
}
}
}
})
return true;
}
if ($.validationEngine.settings.success) { // AJAX SUCCESS, STOP THE LOCATION UPDATE
$.validationEngine.settings.success && $.validationEngine.settings.success();
return true;
}
return false;
},
嗯,我隱藏了,但消息沒有顯示..它也沒有保存...沒有JS在FF中的錯誤,只是沒有做任何事情.. – SoulieBaby
啊我得到它..我改變了不透明度和高度說1和CSS顯示內聯..現在就像一個魅力..謝謝你的幫助! :) – SoulieBaby
哦,對不起,在我匆忙中,我錯過了在動畫函數內部有一個回調! – Colin