Add jquery validation
This commit is contained in:
@@ -189,6 +189,25 @@
|
|||||||
}).filter(':has(:checked)').addClass('active');
|
}).filter(':has(:checked)').addClass('active');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Apply validation
|
||||||
|
$('#form-contact, #form-register').validate({
|
||||||
|
highlight: function(element) {
|
||||||
|
$(element).closest('.form-group').addClass('has-error');
|
||||||
|
},
|
||||||
|
unhighlight: function(element) {
|
||||||
|
$(element).closest('.form-group').removeClass('has-error');
|
||||||
|
},
|
||||||
|
errorElement: 'span',
|
||||||
|
errorClass: 'help-block',
|
||||||
|
errorPlacement: function(error, element) {
|
||||||
|
if(element.parent('.input-group').length || element.prop('type') === 'checkbox' || element.prop('type') === 'radio'){
|
||||||
|
error.prepend('<i class="icon-remove"></i> ').insertAfter(element.parent());
|
||||||
|
}else{
|
||||||
|
error.prepend('<i class="icon-remove"></i> ').insertAfter(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if($("body").is(".page-product")){
|
if($("body").is(".page-product")){
|
||||||
|
|
||||||
|
|||||||
@@ -376,6 +376,9 @@ URL: http://www.thelia.net
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
{javascripts file='assets/js/bootstrap/bootstrap.js'}
|
{javascripts file='assets/js/bootstrap/bootstrap.js'}
|
||||||
<script src="{$asset_url}"></script>
|
<script src="{$asset_url}"></script>
|
||||||
{/javascripts}
|
{/javascripts}
|
||||||
|
|||||||
Reference in New Issue
Block a user