1// VALIDATION CODES 2jQuery(document).ready(function(){ 3 4 jQuery('.wpcf7-validates-as-required').addClass('required'); 5 jQuery('.wpcf7-email').addClass('email'); 6 jQuery('.wpcf7-checkbox.wpcf7-validates-as-required input').addClass('required'); 7 jQuery('.wpcf7-radio input').addClass('required'); 8 9 jQuery('form.wpcf7-form').each(function(){ 10 jQuery(this).addClass(scriptData.jvcf7_default_settings.jvcf7_invalid_field_design); 11 jQuery(this).addClass(scriptData.jvcf7_default_settings.jvcf7_show_label_error); 12 jQuery(this).validate({ 13 ignore: ":hidden input, :hidden textarea, :hidden select", // FOR Hidden element 14 onfocusout: function(element) { // ADD VALIDATION ON BLUR 15 this.element(element); 16 }, 17 errorPlacement: function(error, element) { 18 if (element.is(':checkbox') || element.is(':radio')){ 19 error.insertAfter(jQuery(element).parent().parent().parent()); 20 } else { 21 error.insertAfter(element); 22 } 23 } 24 }); 25 }); 26 27 jQuery('.wpcf7-form-control.wpcf7-submit').click(function(e){ 28 var $jvcfpValidation = jQuery(this).parents('form'); 29 if (!$jvcfpValidation.valid()){ 30 e.preventDefault(); 31 var $errorElements = $jvcfpValidation.find('.wpcf7-form-control.error'); 32 if ($errorElements.length) { 33 var $topErrorPosition = $errorElements.offset().top; 34 $topErrorPosition = parseInt($topErrorPosition) - 100; 35 jQuery('body, html').animate({scrollTop:$topErrorPosition}, 'normal'); 36 } 37 } 38 }); 39}); 40 41jQuery.validator.addMethod("email", 42 function(value, element) { 43 return this.optional(element) || /^[+\w\-\.]+@([\w\-]+\.)+[\w\-]{2,63}$/i.test(value); 44 },"Please enter a valid email address" 45); 46 47jQuery.validator.addMethod("letters_space", function(value, element) { 48 return this.optional(element) || /^[a-zA-Z ]*$/.test(value); 49}, "Letters and space only");
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.