:HTML5 + CSS3 유효성 검사를 사용하여 ZK Textbox의 유효성을 검사하는 방법은 무엇입니까?
<script type="text/javascript">
jQuery(function($) {
$('[data-rel=tooltip]').tooltip();
$(".select2").css('width','200px').select2({allowClear:true})
.on('change', function(){
$(this).closest('form').validate().element($(this));
});
var $validation = false;
//documentation : http://docs.jquery.com/Plugins/Validation/validate
$('#validation-form').validate({
errorElement: 'div',
errorClass: 'help-block',
focusInvalid: false,
rules: {
email: {
required: true,
email:true
}
},
messages: {
email: {
required: "Please provide a valid email.",
email: "Please provide a valid email."
}
},
invalidHandler: function (event, validator) { //display error alert on form submit
$('.alert-danger', $('.login-form')).show();
},
highlight: function (e) {
$(e).closest('.form-group').removeClass('has-info').addClass('has-error');
},
success: function (e) {
$(e).closest('.form-group').removeClass('has-error').addClass('has-info');
$(e).remove();
},
errorPlacement: function (error, element) {
if(element.is(':checkbox') || element.is(':radio')) {
var controls = element.closest('div[class*="col-"]');
if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
}
else if(element.is('.select2')) {
error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));
}
else if(element.is('.chosen-select')) {
error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));
}
else error.insertAfter(element.parent());
},
submitHandler: function (form) {
},
invalidHandler: function (form) {
}
});
$('#modal-wizard .modal-header').ace_wizard();
$('#modal-wizard .wizard-actions .btn[data-dismiss=modal]').removeAttr('disabled');
})
</script>
그것은이다 : 여기
<form id="validation-form">
<fieldset>
<div class="form-group">
<label class="block clearfix" for="email">
<span class="block input-icon input-icon-right">
<z:textbox id="emailInput" type="email" class="form-control" placeholder="${labels.login.email}"/>
<i class="icon-envelope"></i>
</span>
</label>
</div>
<div class="clearfix">
<button id="forgotPassword" type="button" class="width-35 pull-right btn btn-sm btn-danger">
<i class="icon-lightbulb"></i>
${labels.send}
</button>
</div>
</fieldset>
</form>
는 스크립트입니다 작업을 변경할 때 z : 텍스트 입력란을 html로 입력 :
<input id="emailInput" type="email" class="form-control" placeholder="${labels.login.email}"/>
zk 텍스트 상자를 사용하여 어떻게해야합니까?
같이이 전체 라인을 대체 할뿐만 아니라 form validation을 제공합니다.'$ (이) .closest ('양식')를 확인() 요소 ($ (이))'만이. :'$ (this) .valid()' – Sparky
jQuery Validate 플러그인을 사용하는 경우 HTML 5 유효성 검사를 사용하지 않기 때문에 질문이 명확하지 않습니다. (플러그인이 동적으로 ** HTML 5 확인을 비활성화 **). 또한 *** 렌더링 된 *** HTML 마크 업을 브라우저에 표시하고 ** 서버에 업로드 한 코드가 아닌 ** 표시하십시오. – Sparky