그래서 유효성을 검사해야하는 양식이 있습니다. 나머지 폼 유효성 검사는 작동하지만 체크 박스 그룹을 PHP 속성 []을 사용하여 추가하여 배열에 체크 박스를 만듭니다. 체크 박스는 더 이상 내 유효성 검사 스크립트에서 작동하지 않습니다.확인란 "fieldname []"을 사용하면 jquery 유효성 검사가 중단됩니다.
$("form[name='violationsForm']").validate({
ignore: ":hidden,[name='']", // do not validate form fields in invisible sections
errorPlacement: function(error, element) {
$(element).attr("class","error");
error.insertAfter(element);
},
rules: {
owner_address: { required: true, minlength: 5 }
,owner_county: { required: true, minlength: 1 }
,date1: { required: true, minlength: 2 }
,time1: { required: true, minlength: 2 }
,timeframe1: { required: true, minlength: 2 }
,violation[]: { required: true}
}
});
추가 , 위반 [] : {필수 : TRUE} 휴식 전체 검증 스크립트. 다음은 참조 용 입력 양식입니다.
<li>
<label><strong>Type of Violation (required):</strong></label><br />
<label>type 1 <input type="checkbox" id="violation" name="violation[]" value="1"
title="Please choose at least ONE violation."/></label><br />
<label>type 2 <input type="checkbox" id="violation" name="violation[]" value="2" />
</label><br />
<label>type 3 <input type="checkbox" id="violation" name="violation[]" value="3" />
</label><br />
<label>type 4 <input type="checkbox" id="violation" name="violation[]" value="4" />
</label><br />
<label>type 5 <input type="checkbox" id="violation" name="violation[]" value="5" />
</label><br />
<label>Other <input type="checkbox" id="violation_0" name="violation[]" value="other" />
</label><br />
</li>
저는 PHP를 사용하고 있기 때문에 [입력]에 "이름"값을 첨부하고 싶습니다. 이견있는 사람?
감사합니다. 따옴표
는
이 당신의 조언을 주셔서 감사합니다 모든 이스케이프 정보가 있습니다! –