download validate.js
Language: JavaScript
LOC: 288
Project Info
pragati
Server: Novell Forge
Type: cvs
...ti\pragati\Pragati\jscript\
   cbddm.js
   date.js
   exmplmenu_var.js
   menu_com.js
   popcalendar.js
   popcalendarforee.js
   showhide_2.js
   sortTable.js
   style.js
   tooltip.js
   tooltips.js
   validate.js
   vars.js
   vars1.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================

// -------------------------------------------------------------------
// autoComplete (text_input, select_input, ["text"|"value"], [true|false])
//   Use this function when you have a SELECT box of values and a text
//   input box with a fill-in value. Often, onChange of the SELECT box
//   will fill in the selected value into the text input (working like
//   a Windows combo box). Using this function, typing into the text
//   box will auto-select the best match in the SELECT box and do
//   auto-complete in supported browsers.
//   Arguments:
//      field = text input field object
//      select = select list object containing valid values
//      property = either "text" or "value". This chooses which of the
//                 SELECT properties gets filled into the text box -
//                 the 'value' or 'text' of the selected option
//      forcematch = true or false. Set to 'true' to not allow any text
//                 in the text box that does not match an option. Only
//                 supported in IE (possible future Netscape).
// -------------------------------------------------------------------
function autoComplete (field, select, property, forcematch) {
	var found = false;
	for (var i = 0; i < select.options.length; i++) {
	if (select.options[i][property].toUpperCase().indexOf(field.value.toUpperCase()) == 0) {
		found=true; break;
		}
	}
	if (found) { select.selectedIndex = i; }
	else { select.selectedIndex = -1; }
	if (field.createTextRange) {
		if (forcematch && !found) {
			field.value=field.value.substring(0,field.value.length-1); 
			return;
			}
		var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;";
		if (cursorKeys.indexOf(event.keyCode+";") == -1) {
			var r1 = field.createTextRange();
			var oldValue = r1.text;
			var newValue = found ? select.options[i][property] : oldValue;
			if (newValue != field.value) {
				field.value = newValue;
				var rNew = field.createTextRange();
				rNew.moveStart('character', oldValue.length) ;
				rNew.select();
				}
			}
		}
	}

function checkSize(obj)
{
	var actsize = parseFloat(obj.value,10);
	if ( isNaN(obj.value) )
	{
	 alert(obj.name + " Value should be positive number");
	   obj.value = "0.0";
	   obj.select();
	   obj.focus();
	}
	else
	{
	if (actsize < 0 )
	{
	   alert(obj.name + " Value cannot be negative.");
	   obj.value = "0.0";
	   obj.select();
	   obj.focus();
	}
	else if (actsize > 0 && actsize < .01)
	{
		alert(obj.name + " Value cannot less than .01 .");
		obj.value = "0.0";
		obj.select();
		obj.focus();
	}
	return false;
	}
}

function checkprobSize(obj)
{
	var actsize = parseFloat(obj.value,10);
	if ( isNaN(obj.value) )
	{
	 alert("Probability Value should be positive number");
	   obj.value = "0.0";
	   obj.select();
	   obj.focus();
	}
	if (actsize < 0 )
	{
	   alert("Probability Value cannot be negative.");
	   obj.value = "0.0";
	   obj.select();
	   obj.focus();
	}
	else if (actsize > 1)
	{
		alert("Probability Value cannot be greater than 1 .");
		obj.value = "0.0";
		obj.select();
		obj.focus();
	}
	if (actsize == 0.0)
	{
		alert("Probability Value cannot be 0 .");
		obj.value = "0.0";
		obj.select();
		obj.focus();
	}	return false;
}

function checkimpactSize(obj)
{
	var actsize = parseFloat(obj.value,10);
	if ( isNaN(obj.value) )
	{
	 alert("Risk " + obj.name + " Value should be positive number");
	   obj.value = "0";
	   obj.select();
	   obj.focus();
	}
	else
	{
	if (actsize < 0 )
	{
	   alert("Risk " + obj.name + " Value cannot be negative.");
	   obj.value = "0";
	   obj.select();
	   obj.focus();
	}
	else if (actsize > 10 )
	{
		alert("Risk " + obj.name + " Value cannot be greater than 10 .");
		obj.value = "0";
		obj.select();
		obj.focus();
	}
	if (actsize == 0 )
	{
		alert("Risk " + obj.name + " Value cannot be 0 .");
		obj.value = "0";
		obj.select();
		obj.focus();
	}
	return false;
	}
}

//-------------------------------------------------------------------
// setSingleInputValue(input_object,value)
//   Utility function used by others
//-------------------------------------------------------------------
function setSingleInputValue(obj,value) {
	switch(obj.type){
		case 'radio': case 'checkbox': if(obj.value==value){obj.checked=true;return true;}else{obj.checked=false;return false;}
		case 'text': case 'hidden': case 'textarea': case 'password': obj.value=value;return true;
		case 'select-one': case 'select-multiple': 
			var o=obj.options;
			for(var i=0;i<o.length;i++){
				if(o[i].value==value){o[i].selected=true;}
				else{o[i].selected=false;}
				}
			return true;
		}
	alert("FATAL ERROR: Field type "+obj.type+" is not supported for this function");
	return false;
	}

//-------------------------------------------------------------------
// getInputValue(input_object)
//   Get the value of any form input field
//   Multiple-select fields are returned as comma-separated values
//   (Doesn't support input types: button,file,reset,submit)
//-------------------------------------------------------------------
function getInputValue(obj) {
	var use_default=(arguments.length>1)?arguments[1]:false;
	if (isArray(obj) && (typeof(obj.type)=="undefined")) {
		var values=new Array();
		for(var i=0;i<obj.length;i++){
			var v=getSingleInputValue(obj[i],use_default);
			if(v!=null){values[values.length]=v;}
			}
		return commifyArray(values);
		}
	return getSingleInputValue(obj,use_default);
	}

//-------------------------------------------------------------------
// getInputDefaultValue(input_object)
//   Get the default value of any form input field when it was created
//   Multiple-select fields are returned as comma-separated values
//   (Doesn't support input types: button,file,password,reset,submit)
//-------------------------------------------------------------------
function getInputDefaultValue(obj){return getInputValue(obj,true);}

//-------------------------------------------------------------------
// isChanged(input_object)
//   Returns true if input object's value has changed since it was
//   created.
//-------------------------------------------------------------------
function isChanged(obj){return(getInputValue(obj)!=getInputDefaultValue(obj));}

//---------added by pradeep
function checkmyeSize(obj, num)
{
	x = document.mainform;
	if (x.effortcount.value == 1)
	{
		etemp = x.oldeffortspent.value.toString();
	}
	else
	{
	etemp = x.oldeffortspent[num-1].value.toString();
	}
	ttemp = x.totalspenteffort.value.toString();
	var actsize = parseFloat(obj.value,10);
	if ( isNaN(obj.value) )
	{
	 alert(obj.name + " Value should be positive number");
	 obj.value =  etemp;
	 obj.select();
	 obj.focus();
	 return false;
	}
	else
	{
	if (actsize < 0 )
	{
		alert(obj.name + " Value cannot be negative.");
	    obj.value =  etemp;
	    obj.select();
	    obj.focus();
		return false;
	}
	else if (actsize > 0 && actsize < .01)
	{
		alert(obj.name + " Value cannot less than .01 .");
		obj.value = etemp;
		obj.select();
		obj.focus();
		return false;
	}
	//return false;
	}
	
	ftemp = parseFloat(ttemp,4) + parseFloat(obj.value,4) - parseFloat(etemp,4);
	x.totalspenteffort.value = ftemp.toString().substring(0,4);
	if (x.effortcount.value == 1)
	{
		x.oldeffortspent.value = obj.value;
	}
	else
	{
	x.oldeffortspent[num-1].value = obj.value;
	}
	
}

function checkmyrSize(obj, num)
{
	x = document.mainform;
	if (x.effortcount.value == 1)
	{
		rtemp = x.oldremainingeffort.value;
	}
	else
	{
		rtemp = x.oldremainingeffort[num-1].value;
	}
	ttemp = x.totalremeffort.value.toString();
	var actsize = parseFloat(obj.value,10);
	if ( isNaN(obj.value) )
	{
	 alert(obj.name + " Value should be positive number");
	 obj.value = rtemp;
	 obj.select();
	 obj.focus();
	 return false;
	}
	else
	{
	if (actsize < 0 )
	{
	  alert(obj.name + " Value cannot be negative.");
	  obj.value = rtemp;
	  obj.select();
	  obj.focus();
	  return false;
	}
	else if (actsize > 0 && actsize < .01)
	{
		alert(obj.name + " Value cannot less than .01 .");
		obj.value = rtemp;
		obj.select();
		obj.focus();
		return false;
	}
	//return false;
	}
	ftemp = parseFloat(ttemp,4) + parseFloat(obj.value,4) - parseFloat(rtemp,4);
	x.totalremeffort.value = ftemp.toString().substring(0,4);
	if (x.effortcount.value == 1)
	{
		x.oldremainingeffort.value = obj.value;
	}
	else
	{
		x.oldremainingeffort[num-1].value = obj.value;
	}
}

function checkpctSize(obj)
{
	x = document.mainform;
	var actsize = parseFloat(obj.value,10);
	if ( isNaN(obj.value) )
	{
	 alert("Percent Complete Value should be positive number");
	 obj.value =  "0";
	 obj.select();
	 obj.focus();
	 return false;
	}
	else
	{
	if (actsize < 0 )
	{
		alert("Percent Complete Value cannot be negative.");
	    obj.value =  "0";
	    obj.select();
	    obj.focus();
		return false;
	}
	else if (actsize > 100 )
	{
		alert("Percent Complete Value cannot be greater than 100.");
		obj.value = "0";
		obj.select();
		obj.focus();
		return false;
	}
	
	}
	
}

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us