1<script>
2 // Example starter JavaScript for disabling form submissions if there are invalid fields
3 (function() {
4 'use strict';
5 window.addEventListener('load', function() {
6 // Fetch all the forms we want to apply custom Bootstrap validation styles to
7 var forms = document.getElementsByClassName('needs-validation');
8 // Loop over them and prevent submission
9 var validation = Array.prototype.filter.call(forms, function(form) {
10 form.addEventListener('submit', function(event) {
11 if (form.checkValidity() === false) {
12 event.preventDefault();
13 event.stopPropagation();
14 }
15 form.classList.add('was-validated');
16 }, false);
17 });
18 }, false);
19 })();
20 </script>
1function form_validate(attr_id){
2 var result = true;
3 $('#'+attr_id).validator('validate');
4 $('#'+attr_id+' .form-group').each(function(){
5 if($(this).hasClass('has-error')){
6 result = false;
7 return false;
8 }
9 });
10 return result;
11}
12