2009-10-07 52 views
0

我有一個由jquery validate檢查的表單。這是造成一些問題的領域是這樣的:jquery驗證 - 在無線電上失敗

<label>Select an Account Type<</label><br> 

<input type="radio" name="accountType" value="1" id="accountType_C"><label id="accountType_C" for="accountType_C">Coder</label> 
<input type="radio" name="accountType" value="0" id="accountType_S"><label id="accountType_S" for="accountType_S">Surreptitious Ninja</label> 

表格中的所有其他字段與上面的一個例外適當地驗證。不太確定我做錯了什麼。還有大約12個其他領域得到驗證沒有問題。我已經重複檢查重複聲明的驗證,但沒有。

這裏的驗證功能:

$("#regForm").validate({ 

    rules: { 

     accountType: "required" 

    }, 

    messages: { 

     accountType: "You must select an account type" 

    } 

}); 

謝謝了!

+2

嘗試使用規則:{ACCOUNTTYPE:{要求:真正}} – halocursed 2009-10-07 06:20:58

+0

感謝。括號做了詭計! – 2009-10-07 06:53:53

回答

1
$("#regForm").validate({ 

     rules: { 

       accountType: "checked" 

     }, 

     messages: { 

       accountType: "You must select an account type" 

     } 

}); 
0

只是爲了記錄在案;)

$("#regForm").validate({ 
    rules: { 
     accountType: { required: true } 
    }, 
    messages: { 
     accountType: "You must select an account type" 
    } 
});