1$(function() { 2 3 $("#subscribeForm input").jqBootstrapValidation({ 4 preventSubmit: true, 5 submitError: function($form, event, errors) { 6 // additional error messages or events 7 }, 8 9 submitSuccess: function ($form, event) { 10 event.preventDefault(); // prevent default submit behaviour 11 // get values from FORM 12 var subscribeemail = $("input#subscribeemail").val(); 13 14 var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; 15 if (!emailReg.test(subscribeemail)) { 16 alert('Please enter valid email'); 17 return false; 18 } 19 20 $this = $("#sendMessageButton"); 21 $this.prop("disabled", true); // Disable submit button until AJAX call is complete to prevent duplicate messages 22 $.ajax({ 23 url: "././codebehind/subscribe.aspx", 24 type: "POST", 25 data: { 26 subscribeemail: subscribeemail 27 }, 28 cache: false, 29 success: function() { 30 // Success message 31 $('#subscribesuccess').html("<div class='alert alert-success'>"); 32 $('#subscribesuccess > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×") 33 .append("</button>"); 34 $('#subscribesuccess > .alert-success') 35 .append("<strong>Thank you for showing interest in ProducerMAX. We'll add you to our subscription list soon!</strong>"); 36 $('#subscribesuccess > .alert-success') 37 .append('</div>'); 38 //clear all fields 39 $('#subscribeForm').trigger("reset"); 40 }, 41 error: function() { 42 // Fail message 43 $('#subscribesuccess').html("<div class='alert alert-danger'>"); 44 $('#subscribesuccess > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×") 45 .append("</button>"); 46 $('#subscribesuccess > .alert-danger').append($("<strong>An unknown error has occurred. Please try again or email to [email protected]</strong>")); 47 $('#subscribesuccess > .alert-danger').append('</div>'); 48 //clear all fields 49 $('#subscribeForm').trigger("reset"); 50 }, 51 complete: function() { 52 setTimeout(function() { 53 $this.prop("disabled", false); // Re-enable submit button when AJAX call is complete 54 }, 1000); 55 } 56 }); 57 }, 58 filter: function() { 59 return $(this).is(":visible"); 60 }, 61 }); 62 63 $("a[data-toggle=\"tab\"]").click(function(e) { 64 e.preventDefault(); 65 $(this).tab("show"); 66 }); 67}); 68 69/*When clicking on Full hide fail/success boxes */ 70$('#name').focus(function() { 71 $('#success').html(''); 72});
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.