我有2個窗體共享一個提交按鈕。我有那部分工作,我遇到麻煩是將驗證添加到每個表單。這裏是我所擁有的,我之前沒有在提交函數中完成驗證,但通常在文檔準備就緒。需要幫助jQuery驗證
$("#sbtBtn").click(function() {
if($("input[name=license_code]").val()) {
$("#formOne").submit();
} else if ($("input[name=referred_by_text]").val() && $("input[name=broker_text]").val() && $("input[name=email1]").val()) {
$("#formTwo").submit();
}
else {
//need help getting this added as an error message
alert("Please fill out either the returning user or new user form");
}
});
$("#formOne").submit(function() {
//need to put validation and AJAX submit here
});
$("#formTwo").submit(function() {
//need to put validation and AJAX submit here
});
我明白任何幫助,因爲香港專業教育學院只有成功與之前不共享按鈕AJAX形式。 謝謝!
也,如何將添加第四個條件是,如果所有的元素都填寫,顯示錯誤消息「您只能提交一次一個」 **
正如我說我沒有與準備驗證麻煩,但避風港。無法將其作爲提交函數工作 – 2010-10-05 19:58:26