1jQuery(function () { 2 3 for (var i = 0; i < 10; i++) { 4 (function (igroup) { 5 6 $.validator && $.validator.addMethod('group' + igroup + '-AtLeastOneIsFilled', function (value, element) { 7 var isValid = false; 8 $(element).parents('.c-form:first').find('.group' + igroup + '-AtLeastOneIsFilled').each(function (index, input) { 9 if (input.type == 'checkbox' || input.type == 'radio') { 10 if ($(input).is(':checked')) { 11 isValid = true; 12 } 13 } else { 14 if (!isValid && $.trim(input.value).length > 0) { 15 isValid = true; 16 } 17 } 18 }); 19 20 // validate the rest of the controls in the group, but watch out for recursion 21 if (!window['group' + igroup + '-AtLeastOneIsFilled-check']) { 22 window['group' + igroup + '-AtLeastOneIsFilled-check'] = true; 23 $(element).parents('.c-form:first').find('.group' + igroup + '-AtLeastOneIsFilled').each(function () {
24 if ($(this).valid()) { // using the structure of tabspro, repair this if it changes 25 $(this).closest('.tab-content').prev().find('.tabButton.active > .tabLink').removeClass('has-error'); 26 } else { 27 $(this).closest('.tab-content').prev().find('.tabButton.active > .tabLink').addClass('has-error'); 28 } 29 }); 30 window['group' + igroup + '-AtLeastOneIsFilled-check'] = false; 31 } 32 return isValid; 33 }, 'At least one field is required'); 34 })(i); 35 } 36});
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.