0

I am trying to use the jQuery validation plugin to validate my form but cant get it working. I have the script types in the header:

<script type="text/javascript" src="/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="/jquery.validate.js"></script>

And my Form:

<form id="taskentry" method="post">				
				Trip Date<input type="text" class="required" name="trip[Date]" id="tripDate" placeholder="MM/DD/YYYY"/></form>

I tried this but not working:

<script>
		$("#taskentry").validate({
			rules: {
				tripDate: {required: true}
			}
		});
	</script>

How do I implement the validation plugin to use on my form?

Thank You

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by extemer
0

hello friend i have a very simple and easily JQ plugin for you.All you have to do is to include it on your page and change as you want and only changing the textfield id name are required and as much textfield you want to validate you can do this by changing the name in the below plugin as i mention there.not only this but you can increase by adding as many if condition for you textfields for validating.

<script type="text/javascript">
    $(document).ready(function(){
						 
	$("#submit").click(function(){
	
			var show = $("#put textfield number 1 id here").val();
			var show2 = $("#put textfield number 2 id here").val();

			if(show==""){
			
				$("#put textfield number 1 id here").css('border','1px solid #A92149');
			
				}
				
				if(show2==""){
			
				$("#put textfield number 2 id here").css('border','1px solid #A92149');
				return false;
				}
								
});					   
		  $("#center").click(function(){
																															                     var show = $("#put textfield number 1 id here").val();
					 var show2 = $("#put textfield number 2 id here").val();
								   
					 if(show!="" )
						   {
					 $("#put textfield number 1 id here").css('border','1px solid #999');
							   
						   }
						   
						     if(show2!="")
						   {
							   
					 $("#put textfield number 2 id here").css('border','1px solid #999');
							 }
		
});			   						   
});

</script>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.