我有此代码段将提交一个表单一次,以防止多个数据库插入:jQuery的:.validate()函数,并提交一旦功能
// Validates the form data
// Running before submit, otherwise HTTP process starts and we POST
$(".empForm").validate();
// Setting the submit button to enabled
$("input[type='submit']").attr("disabled", false);
// disabling the submit button after it's been pressed atleast once
// Prevents duplicate entries in the database
$(".empForm").submit(function(){
// if it's valid, lock the submit button
// if the form is not valid, they can complete and try again
if($(".empForm").valid()){
$("input[type='submit']").attr("disabled", true).val("Please wait...");
return true;
}// closes if
}); //closes submit
问题是我使用.validate()函数的jQuery和当表单返回为缺少字段时,我无法提交表单,因为它被禁用。有什么建议么?
谢谢你。你可以看看我编辑的代码,看看是否可以代替吗? – 2011-04-27 17:40:17