1var mmcGuestbook = { 2 3 validateForm: function( formNode ){ 4 var formValid = true; 5 // iterate form fields 6 $( formNode ).find('.form-row .validate').each(function(){ 7 $(this).closest('.form-row').removeClass('error'); 8 var fieldValid = true; 9 if( $(this).hasClass('required') && ! $(this).val() ){ 10 fieldValid = false; 11 } 12 if ( $(this).hasClass('email') && ! $(this).val().match(/^$|(\S+@\S+\.\S+)$/) ){ 13 fieldValid = false; 14 } 15 if( $(this).hasClass('mts') && ! mmcGuestbook.validateMathTest( formNode ) ){ 16 fieldValid = false; 17 } 18 if( !fieldValid ){ 19 $(this).closest('.form-row').addClass('error'); 20 if( formValid ) 21 $(this).focus(); 22 formValid = false; 23 } 24 }); 25 // return validation result 26 return formValid; 27 }, 28 29 validateMathTest: function( formNode ){ 30 var $mts; 31 if( ($mts = $(formNode).find('#mmcgbform-mts') ).length == 0 ) 32 return true; // no math test 33 var s = $mts.val(); 34 var l = $(formNode).find('#mmcgbform-mts-label').html(); 35 var expr = l.substr(0, l.search('=')); 36 var s2 = eval( expr ).toString(); 37 return (s == s2); 38 } 39 40}
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.