2
/*$RCSfile: validateFloatRange.js,v $ $Revision: 1.9 $ $Date: 2004/03/28 16:53:21 $ */
4
* Check to see if fields are in a valid float range.
5
* Fields are not checked if they are disabled.
7
* @param form The form validation is taking place on.
9
function validateFloatRange(form) {
11
var focusField = null;
13
var fields = new Array();
14
var formName = form.getAttributeNode("name");
16
oRange = eval('new ' + formName.value + '_floatRange()');
18
var field = form[oRange[x][0]];
20
if ((field.type == 'hidden' ||
21
field.type == 'text' || field.type == 'textarea') &&
22
(field.value.length > 0) &&
23
field.disabled == false) {
25
var fMin = parseFloat(oRange[x][2]("min"));
26
var fMax = parseFloat(oRange[x][2]("max"));
27
var fValue = parseFloat(field.value);
28
if (!(fValue >= fMin && fValue <= fMax)) {
32
fields[i++] = oRange[x][1];
37
if (fields.length > 0) {
39
alert(fields.join('\n'));
b'\\ No newline at end of file'
2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
17
/*$RCSfile: validateFloatRange.js,v $ $Rev: 478676 $ $Date: 2006-11-23 21:35:44 +0000 (Thu, 23 Nov 2006) $ */
19
* Check to see if fields are in a valid float range.
20
* Fields are not checked if they are disabled.
21
* @param form The form validation is taking place on.
23
function validateFloatRange(form) {
25
var focusField = null;
27
var fields = new Array();
29
var oRange = eval('new ' + jcv_retrieveFormName(form) + '_floatRange()');
30
for (var x in oRange) {
31
if (!jcv_verifyArrayElement(x, oRange[x])) {
34
var field = form[oRange[x][0]];
35
if (!jcv_isFieldPresent(field)) {
39
if ((field.type == 'hidden' ||
40
field.type == 'text' || field.type == 'textarea') &&
41
(field.value.length > 0)) {
43
var fMin = parseFloat(oRange[x][2]("min"));
44
var fMax = parseFloat(oRange[x][2]("max"));
45
var fValue = parseFloat(field.value);
46
if (!(fValue >= fMin && fValue <= fMax)) {
50
fields[i++] = oRange[x][1];
55
if (fields.length > 0) {
56
jcv_handleErrors(fields, focusField);