2
/*$RCSfile: validateFloat.js,v $ $Revision: 1.11 $ $Date: 2004/03/28 16:53:21 $ */
4
* Check to see if fields are a valid float.
5
* Fields are not checked if they are disabled.
7
* @param form The form validation is taking place on.
9
function validateFloat(form) {
11
var focusField = null;
13
var fields = new Array();
14
var formName = form.getAttributeNode("name");
16
oFloat = eval('new ' + formName.value + '_FloatValidations()');
18
var field = form[oFloat[x][0]];
20
if ((field.type == 'hidden' ||
21
field.type == 'text' ||
22
field.type == 'textarea' ||
23
field.type == 'select-one' ||
24
field.type == 'radio') &&
25
field.disabled == false) {
29
if (field.type == "select-one") {
30
var si = field.selectedIndex;
32
value = field.options[si].value;
38
if (value.length > 0) {
39
// remove '.' before checking digits
40
var tempArray = value.split('.');
41
//Strip off leading '0'
43
var joinedString= tempArray.join('');
44
while (joinedString.charAt(zeroIndex) == '0') {
47
var noZeroString = joinedString.substring(zeroIndex,joinedString.length);
49
if (!isAllDigits(noZeroString)) {
54
fields[i++] = oFloat[x][1];
57
var iValue = parseFloat(value);
62
fields[i++] = oFloat[x][1];
69
if (fields.length > 0) {
71
alert(fields.join('\n'));
b'\\ No newline at end of file'