我有此代碼段將提交一個表單一次,以防止多個數據庫插入: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