mirror of
				https://github.com/fspc/Yellow-Bike-Database.git
				synced 2025-11-03 17:05:35 -05:00 
			
		
		
		
	Adds error validation for email list slider.
This commit is contained in:
		
							parent
							
								
									763587f840
								
							
						
					
					
						commit
						55a8de3df8
					
				@ -153,8 +153,10 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
 | 
			
		||||
			 <tr>
 | 
			
		||||
			  	<td><label>Email List:</label></td>
 | 
			
		||||
				<td>
 | 
			
		||||
				<div id="email_list_block">
 | 
			
		||||
				<div id="email_list_toggle" style="width: 50px;"></div>
 | 
			
		||||
				<span id="email_list_error"></span>				
 | 
			
		||||
				<div id="email_list_error"></div>
 | 
			
		||||
				</div>				
 | 
			
		||||
				</td>			 
 | 
			
		||||
			 </tr>
 | 
			
		||||
          <tr >
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
 | 
			
		||||
/* errors */
 | 
			
		||||
#waiver_error, #phone_error, #email_error,
 | 
			
		||||
#first_name_error, #last_name_error
 | 
			
		||||
#first_name_error, #last_name_error, #email_list_error
 | 
			
		||||
 {
 | 
			
		||||
	color: red; 
 | 
			
		||||
}
 | 
			
		||||
@ -18,8 +18,9 @@
 | 
			
		||||
	border-color: green;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* get rid of the pesky handle stripping with specificity */
 | 
			
		||||
#email_list_toggle > div > div > div.hello:before, #email_list_toggle > div > div > div.hello:after,
 | 
			
		||||
 | 
			
		||||
/* get rid of the pesky handle stripping with specificity (when figured out) */
 | 
			
		||||
#email_list_toggle > div > div > div:before, #email_list_toggle > div > div > div:after,
 | 
			
		||||
{
 | 
			
		||||
	content: none;
 | 
			
		||||
}
 | 
			
		||||
@ -41,5 +42,10 @@
 | 
			
		||||
	right: -32px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#email_list_block > div {
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* end email list toggle */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,7 @@ $(function(){
 | 
			
		||||
	state_abbreviation.mask('AA',{placeholder: "WV", translation: {"A": {pattern: /[A-Za-z]/, recursive: false} } });
 | 
			
		||||
	
 | 
			
		||||
	// spiff up contact pull down
 | 
			
		||||
	var email_list_choice;	
 | 
			
		||||
	$("select[name='contact_id']").chosen();
 | 
			
		||||
	
 | 
			
		||||
	$("#submit_contact").on("click keypress", function(e) {				
 | 
			
		||||
@ -31,6 +32,9 @@ $(function(){
 | 
			
		||||
		
 | 
			
		||||
		var err0 = 0,  err1 = 0;
 | 
			
		||||
		
 | 
			
		||||
		// if it is showing
 | 
			
		||||
		$("#email_list_error").hide();
 | 
			
		||||
 | 
			
		||||
		// first name & last name input
 | 
			
		||||
		error_handler(first_name.val(), first_name_error, "","*Required",e);
 | 
			
		||||
		error_handler(last_name.val(), last_name_error, "","*Required",e);		
 | 
			
		||||
@ -46,9 +50,13 @@ $(function(){
 | 
			
		||||
			email_error.hide();
 | 
			
		||||
			phone_error.hide();
 | 
			
		||||
			var r = phone_validator(phone.val(),e);
 | 
			
		||||
			
 | 
			
		||||
			var email_list_toggle = $("#email_list_toggle");
 | 
			
		||||
			var email_list_error = $("#email_list_error");
 | 
			
		||||
			if (r) {
 | 
			
		||||
				if($("#email_list_toggle").val() == 1) {
 | 
			
		||||
					console.log("here i am s" + r);
 | 
			
		||||
				if(email_list_toggle.val() == 1) {
 | 
			
		||||
					error_handler(1, email_list_error, 1,"*Email address required for email list",e);
 | 
			
		||||
					email_list_choice = 1;
 | 
			
		||||
				} 				
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
@ -88,8 +96,14 @@ $(function(){
 | 
			
		||||
	    	c--;
 | 
			
		||||
  	} 
 | 
			
		||||
  	
 | 
			
		||||
  	});
 | 
			
		||||
  	
 | 
			
		||||
  	}); // end submit_contact
 | 
			
		||||
  	
 | 
			
		||||
 	$("#email_list_toggle").on("set",function() {  
 | 
			
		||||
  		if ($(this).val() == 0 && email_list_choice) {
 | 
			
		||||
  			$("#email_list_error").hide();
 | 
			
		||||
  		} 
 | 
			
		||||
  	} );	
 | 
			
		||||
  	
 | 
			
		||||
	function phone_validator(val, e) {
 | 
			
		||||
				var re = /^\(\d{3}\)\s?\d{3}-\d{4}$/;
 | 
			
		||||
@ -153,11 +167,6 @@ $(function(){
 | 
			
		||||
	
 | 
			
		||||
	$("#email_list_toggle").addClass('toggle');
 | 
			
		||||
	$("#email_list_toggle").addClass('noUi-extended');
 | 
			
		||||
	$("#email_list_toggle > div > div > div").addClass("hello");	
 | 
			
		||||
	
 | 
			
		||||
	$('.noUi-handle').hover(function(){
 | 
			
		||||
    $(this).attr('data-content','none');
 | 
			
		||||
	});
 | 
			
		||||
	
 | 
			
		||||
		
 | 
			
		||||
	$("#email_list_toggle").Link('lower').to(toggle);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user