Используя этот плагин проверки jQuery.
http://www.benjaminkeen.com/software/rsv/jquery/index.php
Я хочу проверить группу флажков с помощью JS, но когда я использую оператор:
rules.push("required,accomodationtype[],Please check all that apply");
или
rules.push("required,accomodationtype\[\],Please check all that apply");
для этой группы флажков:
<INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_0" value="hotel1">Hotel1<BR>
<INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_1" value="hotel2">Hotel2<BR>
<INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_2" value="hotel3">Hotel3<BR>
<INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_5" value="other"> Other (please specify)<BR>
<INPUT type="text" name="accomodationtypeother" id="accomodationtypeother">
Не проверяется и сразу публикует форму. Я не уверен, что делаю что-то не так.
Кто-нибудь может помочь в этой ситуации?
UPDATE
У меня есть собственный обработчик ошибок. Попробовал предложение Альпера получить это сообщение об ошибке: errorInfo[i][0].focus is not a function
function errorHandler3(f, errorInfo)
{
for (var i=0; i<errorInfo.length; i++)
{
// errorInfo[i][0] contains the form field node that just failed the validation, e.g.
errorInfo[i][0].focus();
// errorInfo[i][1] contains the error string to display for this failed field, e.g.
$.notifyBar({
cls: "error",
html: errorInfo[i][1]
});
}
if (errorInfo.length == 0) tcrform_submit();
return false;
}