2009-10-07 70 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" 
    } 
});