We help IT Professionals succeed at work.
Get Started

jquery validation plugin just not working..

547 Views
Last Modified: 2012-08-14
Hello for some odd reason this , which use to work .. now doesn't.. anyone know what is off here?  The validation script is below.. and the form is located here... http://www.aachamber.org/membership/membership-application.html

Thank you for the help.. Cheers -Jeremy
$(function(){
var val='';
///
	if($("form[name$='Reg']").length>0){
		//alert('found it');
		var validator = $("form[name$='Reg']").validate({
			onkeyup: true
			//,debug:true
		});
	}



	if($("#descriptionofcompany").length>0){ 
		$("#descriptionofcompany").rules("add", {
				required: true,
				onkeyup: true,
				maxlength: 4,
				messages: {
					required: "Please enter a valid email address",
					maxlength: "You have gone passed the 200 word limit."
				}
			});	
	}
	if($("#email").length>0){ 
		$("#email").rules("add", {
				required: true,
				onkeyup: false,
				email:true,
				messages: {
					required: "Please enter a valid email address",
					email: "Please enter a valid E-Mail <em>Try XXXXX@XXXX.XXX</em>"
				}
			});	
		$("#email").change(function() {
			val='';
			var U=$(this).val();
			$(this).closest('.info').append('<img src="http://test.aachamber.org/uploads/images/ajax-loader.gif" id="userL"/>');
			$.get("http://test.aachamber.org/index.php?page=membership-application", { 
					  showtemplate: "false",
					  Email: U
				  },
				  function(data) {
					val=data;
					if($("#userL").length!=0){$("#userL").remove();}
			
						$("#email").rules("add", {
							required: true,
							onkeyup: false,
							remote: "http://test.aachamber.org/index.php?page=membership-application?showtemplate=false&TestEmail=true&Email="+U,
							email:true,
							messages: {
								required: "Please enter a valid email address",
								remote: "Please enter a valid email address",
								email: "Please enter a valid E-Mail <em>Try XXXXX@XXXX.XXX</em>"
							}
						});
					});
			return false;
		});
	}

	if($(".email").length>0){ 
		$(".email").rules("add", {
				required: true,
				onkeyup: false,
				email:true,
				messages: {
					required: "Please enter a valid email address",
					email: "Please enter a valid E-Mail <em>Try XXXXX@XXXX.XXX</em>"
				}
			});	
	
		$(".email").change(function() {
			val='';
			var U=$(this).val();
			$(this).closest('.info').append('<img src="http://test.aachamber.org/uploads/images/ajax-loader.gif" id="userL"/>');
			$.get("http://test.aachamber.org/index.php?page=membership-application", { 
					  showtemplate: "false",
					  Email: U
				  },
				  function(data) {
					val=data;
					if($("#userL").length!=0){$("#userL").remove();}
			
					$(".email").rules("add", {
						required: true,
						onkeyup: false,
						remote: "http://test.aachamber.org/index.php?page=membership-application?showtemplate=false&TestEmail=true&Email="+U,
						email:true,
						messages: {
							required: "Please enter a valid email address",
							remote: "Please enter a valid email address",
							email: "Please enter a valid E-Mail <em>Try XXXXX@XXXX.XXX</em>"
						}
					});
				});
			return false;
		});
	}

});

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE