PageSourceSearch

https://www.afaindia.com/js/FieldValidation.js

js afaindia.com collected 2026-10-10 00:44:55 UTC 20,967 bytes, 1,118 lines download raw bytes

1/* 
2Function to check US Zip Code
3*/
4function isZipCode(s) 
5{
6          
7}
8
9/* 
10Function to check UsPhoneNo: requires object as parameter 
11*/
12
13// Fill Next Phone
14function tabNext(obj,event,len,next_field) {
15	if (event == "down") {phone_field_length=obj.value.length;}
16	else if (event == "up") {
17		if (obj.value.length != phone_field_length) {
18			phone_field_length=obj.value.length;
19			if (phone_field_length == len) {next_field.focus();}
20			}
21		}
22	}
23function ValidateUrl(txtUrl) 
24{ 
25    var v = new RegExp(); 
26    v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); 
27    if (!v.test(txtUrl)) 
28    { 
29        alert("You must supply a valid URL."); 
30        return false; 
31    } 
32} 
33
34function IsValidUrl(txtUrl)
35{
36    var v = new RegExp(); 
37    v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); 
38    if (!v.test(txtUrl.value))
39    {       
40        return false; 
41    }
42    else
43    {
44        return true;
45    }
46}
47function checkURL(value) 
48{
49	var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.){2}");
50	if(urlregex.test(value))
51	{
52	return(true);
53	}
54	return(false);
55}
56
57function IsValidUSPhone(strFieldName)     {
58	//alert(strFieldName);
59     var strValue = strFieldName.value;     
60     var objRegExp  = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
61      if(!objRegExp.test(strValue))
62	  {
63		  return false;
64	  }
65	  else
66	  {
67		  return true;
68	  }
69}
70/*(
71function IsValidUSZIP(strFieldName)     {
72	alert(strFieldName);
73     var strValue = strFieldName.value;
74     var objRegExp  = /(^\d{5}$);
75      if(!objRegExp.test(strValue))
76	  {
77		  return false;
78	  }
79	  else
80	  {
81		  return true;
82	  }
83}
84*/
85/* 
86Function to check IP: requires object as parameter 
87*/
88function IsIP(ParamTxtobj)
89{
90	var makename=ParamTxtobj;
91	var ascCode,i,strRet;
92	var isError,makenameval;
93	var parms;
94	makenameval=ParamTxtobj.value.toLowerCase();
95	strRet="";
96	isError=false;
97	if((makenameval.indexOf('.')==-1)||(makenameval.indexOf('.')==0))	
98	{
99		isError=true;
100		return false;					
101	}
102	if(isError==false)
103	{
104		parms = makenameval.split('.');
105		//alert(parms.length);	
106		//return false;	
107		if(parms.length!=4)
108		{
109			isError=true			
110		}		
111		if(isError==false)
112		{
113			if(parms.length==4)
114			{	
115				for (var i=0; i<parms.length; i++)
116				{
117					if((parms[i].length<1)||(parms[i].length>3))
118					{
119						isError=true;
120						break;		
121					}
122					if(isError==false)
123					{
124						for (var j=0; j<parms[i].length; j++)
125						{
126							ascCode=parms[i].charCodeAt(j);
127							//alert(ascCode);
128							if((ascCode>47 && ascCode<58 ))
129							{
130								isError=false;
131							}	
132							else
133							{
134								isError=true;
135							}
136							if (isError==true) 
137							break;			
138						}	
139					}	
140					if (isError==true) 
141					break;									
142				}								
143			}			
144		}								
145	}
146	//alert(isError);
147	if (isError==true) 
148	{
149		return false;
150	}
151	else
152	{
153		return true;
154	}
155}
156/* 
157Function to check mail address: requires object as parameter 
158*/
159function IsMailAddress(ParamTxtobj)
160{
161	var makename=ParamTxtobj;
162	var ascCode,i,strRet;
163	var isError,makenameval;
164	var parms;
165	makenameval=ParamTxtobj.value.toLowerCase();
166	strRet="";
167	isError=false;
168	if((makenameval.indexOf('.')==-1)||(makenameval.indexOf('.')==0))	
169	{
170		isError=true;
171		return false;					
172	}
173	if(isError==false)
174	{
175		parms = makenameval.split('.');
176		//alert(parms.length);	
177		//return false;	
178		if((parms.length<3)||(parms.length>4))
179		{
180			isError=true			
181		}		
182		if(isError==false)
183		{
184			if(parms.length==3)
185			{	
186				for (var i=0; i<parms.length; i++)
187				{
188					for (var j=0; j<parms[i].length; j++)
189					{
190						ascCode=parms[i].charCodeAt(j);	
191						if((ascCode>96 && ascCode<123 ))
192						{
193							isError=false;
194						}	
195						else
196						{
197							isError=true;
198						}						
199						if (isError==true) 
200						break;			
201					}	
202					if (isError==true) 
203					break;					
204				}								
205			}			
206		}	
207		if(isError==false)
208		{
209			if(parms.length==4)
210			{	
211				for (var i=0; i<parms.length; i++)
212				{
213					if((parms[i].length<1)||(parms[i].length>3))
214					{
215						isError=true;
216						break;		
217					}
218					if(isError==false)
219					{
220						for (var j=0; j<parms[i].length; j++)
221						{
222							ascCode=parms[i].charCodeAt(j);	
223							if((ascCode>47 && ascCode<58 ))
224							{
225								isError=false;
226							}	
227							else
228							{
229								isError=true;
230							}
231							if (isError==true) 
232							break;			
233						}	
234					}	
235					if (isError==true) 
236					break;									
237				}								
238			}			
239		}								
240	}
241	
242	if (isError==true) 
243	{
244		return false;
245	}
246	else
247	{
248		return true;
249	}
250}
251/* 
252Function to check mail address: requires object as parameter 
253*/
254function IsValidEmail(txtEmailId)
255{
256	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txtEmailId.value)== false)
257	{		
258		return false;
259	}
260}
261/* 
262Function to check mail address: requires text as parameter 
263*/
264function IsValidEmailText(txtEmailId)
265{
266	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txtEmailId)== false)
267	{		
268		return false;
269	}
270}
271/*
272
273Function to check UserID: requires object as parameter 
274*/
275function IsUserID(ParamTxtobj)
276{
277	var makename=ParamTxtobj;
278	var ascCode,i,strRet;
279	var isError,makenameval;
280	makenameval=makename.value.toLowerCase();
281	strRet="";
282	for(i=0;i<makenameval.length;i++)
283	{   
284		ascCode=makenameval.charCodeAt(i);
285		//96-123 - small letter
286		//10 - end
287		//47-57 - numeric(0-9)
288		//45 - -
289		//95 - _
290		//46 - .		
291		if((ascCode>96 && ascCode<123 )|| ascCode==10 || ascCode>47 && ascCode<58 || ascCode==45|| ascCode==95 || ascCode==46)
292		{	isError=false; }
293		else
294		{isError=true;}
295		
296		if (isError==true) 
297		break;
298		
299	}
300	if (isError==true) 
301	{
302		return false;
303	}
304	else
305	{
306		return true;
307	}
308}
309/* 
310Function to check Name: requires object as parameter 
311*/
312function IsName(ParamTxtobj)
313{
314	var makename=ParamTxtobj;
315	var ascCode,i,strRet;
316	var isError,makenameval;
317	makenameval=makename.value.toLowerCase();
318	strRet="";
319	for(i=0;i<makenameval.length;i++)
320	{   
321		ascCode=makenameval.charCodeAt(i);
322		//alert(ascCode);
323		//96-123 - small letter
324		//10 - end
325		//32 - space
326		//39 - '	
327		if((ascCode>96 && ascCode<123 )|| ascCode==10 || ascCode==32 || ascCode==39)
328		{	isError=false; }
329		else
330		{isError=true;}
331		
332		if (isError==true) 
333		break;
334		
335	}
336	if (isError==true) 
337	{
338		return false;
339	}
340	else
341	{
342		return true;
343	}
344}
345/* 
346Function to check state,city,country: requires object as parameter 
347*/
348function IsState(ParamTxtobj)
349{
350	var makename=ParamTxtobj;
351	var ascCode,i,strRet;
352	var isError,makenameval;
353	makenameval=makename.value.toLowerCase();
354	strRet="";
355	for(i=0;i<makenameval.length;i++)
356	{   
357		ascCode=makenameval.charCodeAt(i);
358		//96-123 - small letter
359		//10 - end
360		//32 - space
361		//39 - '
362		//38 - &
363		//44 - ,		
364		if((ascCode>96 && ascCode<123 )|| ascCode==10 || ascCode==32 || ascCode==39 || ascCode==38 || ascCode==44)
365		{	isError=false; }
366		else
367		{isError=true;}
368		
369		if (isError==true) 
370		break;
371		
372	}
373	if (isError==true) 
374	{
375		return false;
376	}
377	else
378	{
379		return true;
380	}
381}
382/* 
383Function to check Address: requires object as parameter 
384*/
385function IsAddress(ParamTxtobj)
386{
387	var makename=ParamTxtobj;
388	var ascCode,i,strRet;
389	var isError,makenameval;
390	makenameval=makename.value.toLowerCase();
391	strRet="";
392	for(i=0;i<makenameval.length;i++)
393	{   
394		ascCode=makenameval.charCodeAt(i);
395		//96-123 - small letter
396		//10 - end
397		//32 - space
398		//47-57 - numeric(0-9)
399		//39 - '
400		//44 - ,
401		//38 - &
402		//45 - -
403		//95 - _
404		////46 - .	
405		if((ascCode>96 && ascCode<123 )|| ascCode==10 || ascCode==32 || ascCode>47 && ascCode<58 || ascCode==39 || ascCode==44|| ascCode==38|| ascCode==45|| ascCode==95)
406		{	
407			isError=false; 
408		}
409		else
410		{
411			isError=true;
412		}		
413		if(isError==true) 
414		break;
415		
416	}
417	if (isError==true) 
418	{
419		return false;
420	}
421	else
422	{
423		return true;
424	}
425}	
426/* 
427Function to check Address: requires object as parameter 
428*/
429function IsMailContent(ParamTxtobj)
430{
431	var makename=ParamTxtobj;
432	var ascCode,i,strRet;
433	var isError,makenameval;
434	makenameval=makename.value.toLowerCase();
435	strRet="";
436	for(i=0;i<makenameval.length;i++)
437	{   
438		ascCode=makenameval.charCodeAt(i);
439		//alert(ascCode);		
440		//96-123 - small letter
441		//10 - end
442		//32 - space
443		//47-57 - numeric(0-9)
444		//39 - '
445		//44 - ,
446		//38 - &
447		//45 - -
448		//95 - _
449		////46 - .	
450		//58 - :
451		if((ascCode>96 && ascCode<123 )|| ascCode==10 || ascCode==32 || ascCode>47 && ascCode<58 || ascCode==39 || ascCode==44|| ascCode==38|| ascCode==45|| ascCode==95|| ascCode==58)
452		{	
453			isError=false; 
454		}
455		else
456		{
457			isError=true;
458		}		
459		if(isError==true) 
460		break;
461		
462	}
463	if (isError==true) 
464	{
465		return false;
466	}
467	else
468	{
469		return true;
470	}
471}
472/* 
473Function to check Address: requires object as parameter 
474*/
475function IsDescription(ParamTxtobj)
476{
477	var makename=ParamTxtobj;
478	var ascCode,i,strRet;
479	var isError,makenameval;
480	makenameval=makename.value.toLowerCase();
481	strRet="";
482	for(i=0;i<makenameval.length;i++)
483	{   
484		ascCode=makenameval.charCodeAt(i);
485		//96-123 - small letter
486		//10 - end
487		//32 - space
488		//47-57 - numeric(0-9)
489		//39 - '
490		//44 - ,
491		//38 - &
492		//45 - -
493		//95 - _
494		////46 - .	
495		////13 - enter
496		////13 - enter
497		//@-64
498		if((ascCode>96 && ascCode<123 )|| ascCode==10 || ascCode==32 || ascCode>47 && ascCode<58 || ascCode==39 || ascCode==44|| ascCode==38|| ascCode==45|| ascCode==95|| ascCode==13|| ascCode==64)
499		{	
500			isError=false; 
501		}
502		else
503		{
504			isError=true;
505		}		
506		if(isError==true) 
507		break;
508		
509	}
510	if (isError==true) 
511	{
512		return false;
513	}
514	else
515	{
516		return true;
517	}
518}	
519/* 
520Function to check string value : requires object as parameter 
521*/
522function IsString(ParamTxtobj)
523{
524	var makename=ParamTxtobj;
525	var ascCode,i,strRet;
526	var isError,makenameval;
527	makenameval=makename.value.toLowerCase();
528	strRet="";
529	for(i=0;i<makenameval.length;i++)
530	{   
531		ascCode=makenameval.charCodeAt(i);
532		//96-123 - small letter
533		//10 - end		
534		if((ascCode>96 && ascCode<123 )|| ascCode==10)
535		{	
536			isError=false; 
537		}
538		else
539		{
540			isError=true;
541		}		
542		if(isError==true) 
543		break;
544		
545	}
546	if (isError==true) 
547	{
548		return false;
549	}
550	else
551	{
552		return true;
553	}
554}		
555/* 
556Function to check Alpha Numeric value : requires object as parameter 
557*/
558function IsAlphaNumeric(ParamTxtobj)
559{
560	var makename=ParamTxtobj;
561	var ascCode,i,strRet;
562	var isError,makenameval;
563	makenameval=makename.value.toLowerCase();
564	strRet="";
565	for(i=0;i<makenameval.length;i++)
566	{   
567		ascCode=makenameval.charCodeAt(i);
568		//96-123 - small letter
569		//10 - end		
570		//47-57 - numeric(0-9)		
571		if((ascCode>96 && ascCode<123 )|| ascCode==10 || ascCode>47 && ascCode<58 )
572		{	
573			isError=false; 
574		}
575		else
576		{
577			isError=true;
578		}		
579		if(isError==true) 
580		break;
581		
582	}
583	if (isError==true) 
584	{
585		return false;
586	}
587	else
588	{
589		return true;
590	}
591}	
592/* 
593Function to check Numeric value : requires object as parameter 
594*/
595function IsNumeric(ParamTxtobj)
596{
597	var makename=ParamTxtobj;
598	var ascCode,i,strRet;
599	var isError,makenameval;
600	var countDecimal=1;
601	makenameval=makename.value.toLowerCase();
602	strRet="";
603	
604	for(i=0;i<makenameval.length;i++)
605	{   
606		ascCode=makenameval.charCodeAt(i);	
607		//10 - end		
608		//47-57 - numeric(0-9)		
609		//46 - .
610		//96-123 - small letter
611		if(ascCode==45 && i==0)
612		{
613		    isError=false; 
614		}
615		else if(ascCode==43 && i==0)
616		{
617		    isError=false; 
618		}
619		else if(ascCode==46 && countDecimal==1)
620		{
621		    isError=false;
622		    countDecimal=countDecimal+1;		    
623		}
624		else if(ascCode==10 || ascCode>47 && ascCode<58 )
625		{	
626			isError=false; 
627		}	
628		
629		else
630		{
631			isError=true;
632		}		
633		if(isError==true) 
634		break;
635		
636	}
637	if (isError==true) 
638	{
639		return false;
640	}
641	else
642	{
643		return true;
644	}
645}
646/* 
647Function to check Numeric value : requires object as parameter 
648*/
649function IsPureInteger(ParamTxtobj)
650{
651	var makename=ParamTxtobj;
652	var ascCode,i,strRet;
653	var isError,makenameval;
654	makenameval=makename.value.toLowerCase();
655	strRet="";
656	for(i=0;i<makenameval.length;i++)
657	{   
658		ascCode=makenameval.charCodeAt(i);	
659		//10 - end		
660		//47-57 - numeric(0-9)			
661		//96-123 - small letter
662		if(ascCode==10 || ascCode>47 && ascCode<58)
663		{	
664			isError=false; 
665		}
666		else
667		{
668			isError=true;
669		}		
670		if(isError==true) 
671		break;
672	}
673	if (isError==true) 
674	{
675		return false;
676	}
677	else
678	{
679		return true;
680	}
681}
682/* 
683Function to check valid ZIP : requires object as parameter
684Logic:
685Length should be greater than or equal to 5 and less than or equal to 10
686Only Numeric value is permissible
687*/
688function IsZip(ParamTxtobj)
689{
690	var makename=ParamTxtobj;
691	var ascCode,i,strRet;
692	var isError,makenameval;
693	makenameval=makename.value.toLowerCase();
694	strRet="";
695	isError=false; 
696	if((makenameval.length<=5)&&(makenameval.length>=10))
697	{
698		isError=true;
699	}
700	if(isError==false)
701	{
702		for(i=0;i<makenameval.length;i++)
703		{   
704			ascCode=makenameval.charCodeAt(i);			
705			//10 - end			
706			//47-57 - numeric(0-9)		
707			if(ascCode==10 || ascCode>47 && ascCode<58 ||(ascCode>96 && ascCode<123 ))
708			{	
709				isError=false; 
710			}
711			else
712			{
713				isError=true;
714			}		
715			if (isError==true) 
716			break;
717			
718		}
719	}	
720	if (isError==true) 
721	{
722		return false;
723	}
724	else
725	{
726		return true;
727	}
728}		
729/* 
730Function to check valid Phone : requires object as parameter
731Logic:
732Length should be greater than or equal to 10 and less than or equal to 15
733Only Numeric value is permissible
734*/
735function IsPhone(ParamTxtobj)
736{
737	var makename=ParamTxtobj;
738	var ascCode,i,strRet;
739	var isError,makenameval;
740	makenameval=makename.value.toLowerCase();
741	strRet="";
742	isError=false; 
743	if((makenameval.length<=10)&&(makenameval.length>=15))
744	{
745		isError=true;
746	}
747	if(isError==false)
748	{
749		for(i=0;i<makenameval.length;i++)
750		{   
751			ascCode=makenameval.charCodeAt(i);
752			//10 - end
753			//47-57 - numeric(0-9)		
754			//alert(ascCode);	
755			if(ascCode==10 || ascCode==40 ||ascCode==41 || ascCode>47 && ascCode<58 )
756			{	
757				isError=false; 
758			}
759			else
760			{
761				isError=true;
762			}		
763			if (isError==true) 
764			break;			
765		}
766	}	
767	if (isError==true) 
768	{
769		return false;
770	}
771	else
772	{
773		return true;
774	}
775}	
776/* 
777Function to check valid POP3 port : requires object as parameter
778Logic:
779Length should be greater than or equal to 1 and less than or equal to 3
780Only Numeric value is permissible
781*/
782function IsPOP3(ParamTxtobj)
783{
784	var makename=ParamTxtobj;
785	var ascCode,i,strRet;
786	var isError,makenameval;
787	makenameval=makename.value.toLowerCase();
788	strRet="";
789	isError=false; 
790	if((makenameval.length<=1)&&(makenameval.length>=3))
791	{
792		isError=true;
793	}
794	if(makenameval==0)
795	{
796		isError=true;
797	}
798	if(isError==false)
799	{
800		for(i=0;i<makenameval.length;i++)
801		{   
802			ascCode=makenameval.charCodeAt(i);
803			//10 - end
804			//47-57 - numeric(0-9)			
805			if(ascCode==10 || ascCode>47 && ascCode<58 )
806			{	
807				isError=false; 
808			}
809			else
810			{
811				isError=true;
812			}		
813			if (isError==true) 
814			break;
815			
816		}
817	}	
818	if (isError==true) 
819	{
820		return false;
821	}
822	else
823	{
824		return true;
825	}
826}	
827/* 
828Function to check valid SMTP port : requires object as parameter
829Logic:
830Length should be greater than or equal to 1 and less than or equal to 2
831Only Numeric value is permissible
832*/
833function IsSMTP(ParamTxtobj)
834{
835	var makename=ParamTxtobj;
836	var ascCode,i,strRet;
837	var isError,makenameval;
838	makenameval=makename.value.toLowerCase();
839	strRet="";
840	isError=false; 
841	if((makenameval.length<=1)&&(makenameval.length>=2))
842	{
843		isError=true;
844	}
845	if(makenameval==0)
846	{
847		isError=true;
848	}
849	if(isError==false)
850	{
851		for(i=0;i<makenameval.length;i++)
852		{   
853			ascCode=makenameval.charCodeAt(i);
854			//10 - end
855			//47-57 - numeric(0-9)			
856			if(ascCode==10 || ascCode>47 && ascCode<58 )
857			{	
858				isError=false; 
859			}
860			else
861			{
862				isError=true;
863			}		
864			if (isError==true) 
865			break;
866			
867		}
868	}	
869	if (isError==true) 
870	{
871		return false;
872	}
873	else
874	{
875		return true;
876	}
877}	
878/* Last Update: 20/05/01   */
879// func isblank()parameter is string to be compared. returns true if it does not contain any 
880// non-whitespace character
881function isblank(strval)
882{
883   if (typeof(strval) == "object")
884   {  objtrim(strval);
885	  str = strval.value;
886   }
887   else
888   { 
889    str = strtrim(strval); 
890   }
891
892   var len = str.length;
893   for (var i = 0; i < len; i++)
894   {
895      if (str.charAt(i) != " ")
896      {
897	     return false;				// If there is any non-space character, isblank() returns false
898      }
899   }
900   return true;
901}
902
903// Alltrim function meant only for string value. Returns trimmed value
904// Last Modify : 28/05/01
905function strtrim(val)
906{
907   while('' + val.charAt(0)==' ')
908   {
909      val = val.substring(1,val.length);
910   }
911
912   while('' + val.charAt(val.length-1)==' ')
913   {
914      val = val.substring(0,val.length-1)
915   }
916
917   return val;
918}
919
920// Alltrim func when object is passed. 
921// last Modify : 28/05/01
922function objtrim(box)
923{
924   while('' + box.value.charAt(0)==' ')
925   {
926      box.value = box.value.substring(1,box.value.length);
927   }
928
929   while(''+box.value.charAt(box.value.length-1)==' ')
930   {
931      box.value = box.value.substring(0,box.value.length-1)
932   }
933
934}
935
936// Function to return false if there are any single quotes in 
937function noquotes(str)
938{
939   for (var i=0; i < str.length ; i++ )
940   {
941      if (str.charAt(i) == "'")
942      {
943	     return false;				// If the is any non-space character, isblank() returns false
944      }
945   }
946   return true;
947}
948//Function to validate date.
949//Input parameter : textbox control
950function ScanDate(ParamTxtobj)
951    {
952    	
953		var vartxt1;
954		vartxt1=ParamTxtobj;	
955		
956		
957		//DATE SHOULD BE OF MAX 10 CHARACTERS
958		if(vartxt1.length > 10 || vartxt1.length < 8)
959		{
960			 alert("Enter a valid date,date should be in 'MM/DD/YYYY' format");
961			 return false;	
962		}
963		else 
964		{
965		
966			var vdate,vs1,vmonth,vs2,vyear;
967			var fsindex1,fsindex2,leapyear;
968			
969			fsindex1=vartxt1.indexOf('/') //GETTING INDEX OF 1 ST OCCURENCE OF "/"
970			fsindex2=vartxt1.lastIndexOf('/')//GETTING INDEX OF 2ND OCCURENCE OF "/"
971			
972			vmonth=vartxt1.substring(0,fsindex1);
973			vdate=vartxt1.substring(fsindex1+1,fsindex2);
974			vyear=vartxt1.substring(fsindex2+1,vartxt1.length);		
975			
976			
977			if(vyear %4==0)
978			{
979			    leapyear='true';			
980			}
981			
982			if(vyear %100==0)
983			{
984			    if(vyear %400==0)
985			    {
986			        leapyear='true';
987			    }
988			    else
989			    {
990			        leapyear='false';
991			    }
992			    
993			}			
994			
995			if(isNaN(vdate) ||isNaN(vmonth)|| isNaN(vyear))
996			{
997			    alert(" Please eneter date in 'MM/DD/YYYY' format");
998				return false;
999			
1000			}
1001			//MONTH CAN'T BE LESS THAN 0 OR GREATER THAN 12
1002			if(vmonth > 12 || vmonth < 1)
1003			 {
1004				 alert("Please enter a valid month. Date shoud be in 'MM/DD/YYYY format' ");
1005				 return false;
1006			 }
1007			 
1008			 // CHECKING IF DATE IS ENTERED FOR MOTHH OF FEBRYARY
1009			
1010			if( vmonth == 2 )
1011			{
1012			    if(leapyear=='true')
1013			    {
1014			        if(vdate>29 || vdate <1)
1015				    {
1016					   alert("Please enter a date between 1 to 29.");
1017					    return false;
1018				    }
1019			    
1020			    }
1021			    else
1022			    {
1023			        if(vdate>28 || vdate <1)
1024				    {
1025					    alert("Please enter a date between 1 to 28.");
1026					    return false;
1027				    }
1028			    
1029			    }
1030				
1031			
1032			}
1033			
1034			if(vmonth =="1" || vmonth =="01" || vmonth =="3" || vmonth =="03" || vmonth =="5" || vmonth =="05" || vmonth =="7" || vmonth =="07" || vmonth =="8" || vmonth =="08" || vmonth =="10" || vmonth =="12")
1035			{
1036				if(vdate < 01 || vdate > 31)
1037				{
1038					alert("Please give a valid date for the entered month");
1039					return false;
1040				}
1041			
1042			}
1043			
1044			else
1045			{
1046				if(vdate < 1 || vdate > 30)
1047				{
1048					alert("Please give a valid date for the entered month");
1049					return false;
1050				}
1051			
1052			}
1053			
1054		}
1055		
1056    	return true;
1057    }
1058    
1059    
1060//Function to validate Time.
1061//Input parameter : textbox control
1062function checkTime(ParamTxtobj)
1063   {
1064    	
1065		var vartxt1;
1066		vartxt1=ParamTxtobj;
1067		
1068		//Time SHOULD BE OF MAX 8 CHARACTERS
1069		if(vartxt1.length > 8 || vartxt1.length < 6)
1070		{
1071			 alert("1. Enter a valid time, Time should be in 'hh:mm am' format");
1072			 return false;	
1073		}
1074		else 
1075		{
1076		
1077			var vAMPM,vs1,vMinute,vs2,vHour;
1078			var fsindex1,fsindex2;
1079			
1080			fsindex1=vartxt1.indexOf(':') //GETTING INDEX OF 1 ST OCCURENCE OF ":"
1081			fsindex2=vartxt1.indexOf(' ')//GETTING INDEX OF 1st OCCURENCE OF " "
1082			
1083			vHour=vartxt1.substring(0,fsindex1);
1084			//vMinute=vartxt1.substring(fsindex1+1,fsindex2);
1085			vMinute=vartxt1.substring(fsindex1+1,fsindex1+3);
1086			vAMPM=vartxt1.substring(vartxt1.length-2,vartxt1.length);
1087			//vAMPM=vartxt1.substring(fsindex1+4,vartxt1.length);
1088			//vAMPM=vartxt1.substring(fsindex2+1,vartxt1.length);		
1089			
1090			// 
1091			if(isNaN(vHour) ||isNaN(vMinute))
1092			{
1093			    alert("2. Enter a valid time, Time should be in 'hh:mm am' format");
1094				return false;			
1095			}
1096			else if(vAMPM != 'am' && vAMPM != 'AM' && vAMPM != 'pm' && vAMPM != 'PM')
1097			{
1098			    alert("3. Enter a valid time, Time should be in 'hh:mm am' format");
1099				return false;
1100			}			
1101			//Check Hour
1102			if(vHour > 12 || vHour < 1)
1103			{
1104				 alert("4. Enter a valid time, Time should be in 'hh:mm am' format");
1105				 return false;
1106			}
1107			 
1108			 //Check Minute
1109			if(vMinute > 59 || vMinute < 0)
1110			{
1111				 alert("5. Enter a valid time, Time should be in 'hh:mm am' format");
1112				 return false;
1113			}
1114		}
1115		
1116    	return true;
1117    }
1118

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.