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 onfocusout: function(element) { // ADD VALIDATION ON BLUR 18 this.element(element); 19 }, 20 errorPlacement: function(error, element) { 21 if (element.is(':checkbox') || element.is(':radio')){ 22 error.insertAfter(jQuery(element).parent().parent().parent()); 23 } else { 24 error.insertAfter(element); 25 } 26 } 27 }); 28 }); 29 30 jQuery('.wpcf7-form-control.wpcf7-submit').click(function(e){ 31 $jvcfpValidation = jQuery(this).parents('form'); 32 if (!jQuery($jvcfpValidation).valid()){ 33 e.preventDefault(); 34 $topErrorPosition = jQuery('.wpcf7-form-control.error').offset().top; 35 $topErrorPosition = parseInt($topErrorPosition) - 100; 36 jQuery('body, html').animate({scrollTop:$topErrorPosition}, 'normal'); 37 } 38 }); 39}); 40 41jQuery.validator.addMethod("email", 42 function(value, element) { 43 return this.optional(element) || /^[+\w-\.]+@([\w-]+\.)+[\w-]{2,10}$/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.