Jump to content

Recommended Posts

I'm not sure where I can find the plug-in that I need to do this so I randomly found one form validation and used it but still not sure what I can do to make it how I want it.

 

There are a few requirements I need for my form validation

I have four fields

 

Username         which is a required field and must be 3-6 characters in length

Birthday            which must be a date

Email                 which is also required with a valid email address

Home Page       which must be a valid url

 

Also if any of those requirements aren't met then the background of the text field will be some other color except white for 3 seconds then back to original white.

 

Anyone know where I can find a plug-in for such requirement?

 

Or if someone can give me a hand with the current plug-in I have now....

 

the plug-in I have now I just have to put

 

class="required email"
 

 

then it'll validate if it's a valid email and make sure the field is required if not filled.

I did some work to make the username to meet the requirement with 3-6 characters in length and background will change and applied for 3 seconds only

 

this is my code

 

	$("form").validate();
	
	$("#form").on("submit", function (){

		user = $("#username").val().length;    
		if (user < 3 || user > 6)
		{
			$("#username").css("background","yellow");

			setTimeout(function ()
			{
				$('#username').css('background', 'white'); 
			}, 3000);
		   return false;
		}

but this only applies to username the headache I'm having now is how to apply the background change to all the other 3 fields....

 

Anyone able to give me a hand?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.