1function Form (){ 2 3 this.init = function(){ 4 (function($) { 5 self.setPlaceholders(); 6 $('form').submit(function(e) { 7 self.doValidation(this); 8 e.preventDefault(); 9 }) 10 })(jQuery); 11 } 12 13 this.setPlaceholders = function(){ 14 (function($) { 15 if(!$.browser.msie) { 16 $('input.text').each(function(k,v) { 17 var label = $(v).parent().find('label'); 18 19 if(label.length < 1){ 20 label = $(v).parents('.field').find('label'); 21 } 22 $(v).attr('placeholder', label.text()); 23 label.hide(); 24 }); 25 } 26 else { 27 $('input.text').each(function(k,v) { 28 var label = $(v).parent().find('label'); 29 30 if($(v).val() == "") 31 $(v).attr('value', label.text()); 32 33 $(v).focus(function() { 34 var label = $(field).parent().find('label'); 35 $(this).val(''); 36 }); 37 38 $(v).blur(function() { 39 if($(this).val() == '') 40 $(this).val(label.text()); 41 }) 42 43 label.hide(); 44 45 }); 46 } 47 })(jQuery); 48 } 49 50 this.doValidation = function(f){ 51 (function($) { 52 var fields = new Array( "Name", "Mailadresse", "Telefon", "Betreff", "Nachricht", "Vorname", "Nachname", "Email" ); 53 var errors = ''; 54 55 $(fields).each(function(k,v) { 56 var field = $(f).find('[name="'+v+'"]'); 57 var label = $(field).parent().find('label'); 58 59 if($(field).val() == '' || $(field).val() == label.text()) { 60 errors += 'Bitte füllen Sie das Feld <b>"'+field.attr('name')+'"</b> aus.<br />'; 61 field.addClass('error'); 62 } 63 64 }); 65 66 if(errors != '') { 67 bootbox.alert(errors); 68 } 69 else { 70 $('form').submit(); 71 } 72 })(jQuery); 73 } 74 75 var self = this; 76} 77var form = new Form(); 78 79(function($) { 80 $(document).ready(function(){ 81 form.init(); 82 }); 83})(jQuery);
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.