PageSourceSearch

https://boeason.com/wp-content/themes/boeason-bootstrap/js/optin-validation.js

js boeason.com collected 2026-10-04 02:16:39 UTC 1,982 bytes, 75 lines download raw bytes

1/* Form Validation */
2$(document).ready(function() {
3	$('form#optin-form').submit(function() {
4		var sendForm = true;
5		// Reset errors
6		$(this).find('input.error').removeClass('error');
7		
8		// regex for input fields
9		var nameReg = /^[A-Za-z +]+$/;
10		var emailReg = /[-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+\.[a-zA-Z]{2,4}/;
11		// input fields 
12		var name = $('#inf_field_FirstName');
13		var email = $('#inf_field_Email');
14		
15		// check inputs to regex
16		if (!name.val().match(nameReg)) {
17			$(name).addClass('error');
18			sendForm = false;
19		} 
20		if (!email.val().match(emailReg)) {
21			$(email).addClass('error');
22			sendForm = false;
23		}
24		
25		if (sendForm) {
26			return true;
27		} else {
28			return false;
29		}
30	});    
31		
32	//Bootstrap Optin Validation							
33  $('#optin-form-alt, #optin-form-new').bootstrapValidator({
34    	live: 'submitted',
35			feedbackIcons: {
36          valid: 'glyphicon glyphicon-ok',
37          invalid: 'glyphicon glyphicon-remove',
38          validating: 'glyphicon glyphicon-refresh'
39      },
40			fields: {
41          inf_field_FirstName: {
42              validators: {
43                  notEmpty: {
44                      message: 'Your first name is required...'
45                  }
46              }
47          },	            
48          inf_field_Email: {
49              validators: {
50                  notEmpty: {
51                      message: 'Your email address is required...'
52                  },
53                  emailAddress: {
54                      message: 'Please enter a valid email address...'
55                  }
56              }
57          }
58			}	            
59  })
60  .on('success.form.bv', function(e) {
61    $(".optin-form-lightbox-hide, #securityhide, #headline-hide").hide();
62    $("#optin-form-success").show();  
63  });
64});
65
66function clickclear(thisfield, defaulttext) {
67	if (thisfield.value == defaulttext) {
68	thisfield.value = "";
69	}
70}
71function clickrecall(thisfield, defaulttext) {
72  if (thisfield.value == "") {
73  thisfield.value = defaulttext;
74  }
75}

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.