From: "Salvato da Internet Explorer 11" Subject: Conferma Date: Wed, 6 Dec 2017 11:59:46 +0100 MIME-Version: 1.0 Content-Type: multipart/related; type="text/html"; boundary="----=_NextPart_000_0000_01D36E89.B6280F90" X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.23651 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01D36E89.B6280F90 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Location: https://www.acquistinretepa.it/transazioni/manageOrdineAcquisto.do?adfgenDispatchAction=generaDocumento&ID_ODA=4015089&strumento=mepa&originalStatus=1 =EF=BB=BF
validateMinLength
on =
a password field in a =0A=
* login page gives unnecessary information away to hackers. While =
it only slightly=0A=
* weakens security, we suggest using it only when modifying a =
password.=0A=
* @param form The form validation is taking place on.=0A=
*/=0A=
function validateMinLength(form) {=0A=
var isValid =3D true;=0A=
var focusField =3D null;=0A=
var i =3D 0;=0A=
var fields =3D new Array();=0A=
=0A=
var oMinLength =3D eval('new ' + jcv_retrieveFormName(form) + =
'_minlength()');=0A=
=0A=
for (var x in oMinLength) {=0A=
if (!jcv_verifyArrayElement(x, oMinLength[x])) {=0A=
continue;=0A=
}=0A=
var field =3D form[oMinLength[x][0]];=0A=
if (!jcv_isFieldPresent(field)) {=0A=
continue;=0A=
}=0A=
=0A=
if ((field.type =3D=3D 'hidden' ||=0A=
field.type =3D=3D 'text' ||=0A=
field.type =3D=3D 'password' ||=0A=
field.type =3D=3D 'textarea')) {=0A=
=0A=
/* Adjust length for carriage returns - see Bug 37962 */=0A=
var lineEndLength =3D oMinLength[x][2]("lineEndLength");=0A=
var adjustAmount =3D 0;=0A=
if (lineEndLength) {=0A=
var rCount =3D 0;=0A=
var nCount =3D 0;=0A=
var crPos =3D 0;=0A=
while (crPos < field.value.length) {=0A=
var currChar =3D field.value.charAt(crPos);=0A=
if (currChar =3D=3D '\r') {=0A=
rCount++;=0A=
}=0A=
if (currChar =3D=3D '\n') {=0A=
nCount++;=0A=
}=0A=
crPos++;=0A=
}=0A=
var endLength =3D parseInt(lineEndLength);=0A=
adjustAmount =3D (nCount * endLength) - (rCount + =
nCount);=0A=
}=0A=
=0A=
var iMin =3D parseInt(oMinLength[x][2]("minlength"));=0A=
if ((trim(field.value).length > 0) && =
((field.value.length + adjustAmount) < iMin)) {=0A=
if (i =3D=3D 0) {=0A=
focusField =3D field;=0A=
}=0A=
fields[i++] =3D oMinLength[x][1];=0A=
isValid =3D false;=0A=
}=0A=
}=0A=
}=0A=
if (fields.length > 0) {=0A=
jcv_handleErrors(fields, focusField);=0A=
}=0A=
return isValid;=0A=
}=0A=
=0A=
/*$RCSfile: validateUtilities.js,v $ $Rev: 376673 $ $Date: =
2006-02-10 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A=
=0A=
/**=0A=
* This is a place holder for common utilities used across the =
javascript validation=0A=
*=0A=
**/=0A=
=0A=
/**=0A=
* Retreive the name of the form=0A=
* @param form The form validation is taking place on.=0A=
*/=0A=
function jcv_retrieveFormName(form) {=0A=
=0A=
// Please refer to Bugs 31534, 35127, 35294, 37315 & 38159=0A=
// for the history of the following code=0A=
=0A=
var formName;=0A=
=0A=
if (form.getAttributeNode) {=0A=
if (form.getAttributeNode("id") && =
form.getAttributeNode("id").value) {=0A=
formName =3D form.getAttributeNode("id").value;=0A=
} else {=0A=
formName =3D form.getAttributeNode("name").value;=0A=
}=0A=
} else if (form.getAttribute) {=0A=
if (form.getAttribute("id")) {=0A=
formName =3D form.getAttribute("id");=0A=
} else {=0A=
formName =3D form.attributes["name"];=0A=
}=0A=
} else {=0A=
if (form.id) {=0A=
formName =3D form.id;=0A=
} else {=0A=
formName =3D form.name;=0A=
}=0A=
}=0A=
=0A=
return formName;=0A=
=0A=
} =0A=
=0A=
/**=0A=
* Handle error messages.=0A=
* @param messages Array of error messages.=0A=
* @param focusField Field to set focus on.=0A=
*/=0A=
function jcv_handleErrors(messages, focusField) {=0A=
if (focusField && focusField !=3D null) {=0A=
var doFocus =3D true;=0A=
if (focusField.disabled || focusField.type =3D=3D 'hidden') {=0A=
doFocus =3D false;=0A=
}=0A=
if (doFocus && =0A=
focusField.style && =0A=
focusField.style.visibility &&=0A=
focusField.style.visibility =3D=3D 'hidden') {=0A=
doFocus =3D false;=0A=
}=0A=
if (doFocus) {=0A=
focusField.focus();=0A=
}=0A=
}=0A=
alert(messages.join('\n'));=0A=
}=0A=
=0A=
/**=0A=
* Checks that the array element is a valid=0A=
* Commons Validator element and not one inserted by=0A=
* other JavaScript libraries (for example the=0A=
* prototype library inserts an "extends" into=0A=
* all objects, including Arrays).=0A=
* @param name The element name.=0A=
* @param value The element value.=0A=
*/=0A=
function jcv_verifyArrayElement(name, element) {=0A=
if (element && element.length && element.length =3D=3D 3) {=0A=
return true;=0A=
} else {=0A=
return false;=0A=
}=0A=
}=0A=
=0A=
/**=0A=
* Checks whether the field is present on the form.=0A=
* @param field The form field.=0A=
*/=0A=
function jcv_isFieldPresent(field) {=0A=
var fieldPresent =3D true;=0A=
if (field =3D=3D null || field =3D=3D undefined) {=0A=
fieldPresent =3D false;=0A=
} else {=0A=
if (field.disabled) {=0A=
fieldPresent =3D false;=0A=
}=0A=
}=0A=
return fieldPresent;=0A=
}=0A=
=0A=
/**=0A=
* Check a value only contains valid numeric digits=0A=
* @param argvalue The value to check.=0A=
*/=0A=
function jcv_isAllDigits(argvalue) {=0A=
argvalue =3D argvalue.toString();=0A=
var validChars =3D "0123456789";=0A=
var startFrom =3D 0;=0A=
if (argvalue.substring(0, 2) =3D=3D "0x") {=0A=
validChars =3D "0123456789abcdefABCDEF";=0A=
startFrom =3D 2;=0A=
} else if (argvalue.charAt(0) =3D=3D "0") {=0A=
validChars =3D "01234567";=0A=
startFrom =3D 1;=0A=
} else if (argvalue.charAt(0) =3D=3D "-") {=0A=
startFrom =3D 1;=0A=
}=0A=
=0A=
for (var n =3D startFrom; n < argvalue.length; n++) {=0A=
if (validChars.indexOf(argvalue.substring(n, n+1)) =3D=3D -1) =
return false;=0A=
}=0A=
return true;=0A=
}=0A=
=0A=
/**=0A=
* Check a value only contains valid decimal digits=0A=
* @param argvalue The value to check.=0A=
*/=0A=
function jcv_isDecimalDigits(argvalue) {=0A=
argvalue =3D argvalue.toString();=0A=
var validChars =3D "0123456789";=0A=
=0A=
var startFrom =3D 0;=0A=
if (argvalue.charAt(0) =3D=3D "-") {=0A=
startFrom =3D 1;=0A=
}=0A=
=0A=
for (var n =3D startFrom; n < argvalue.length; n++) {=0A=
if (validChars.indexOf(argvalue.substring(n, n+1)) =3D=3D -1) =
return false;=0A=
}=0A=
return true;=0A=
}=0A=
=0A=
=0A=
/*$RCSfile: validateFloatRange.js,v $ $Rev: 376673 $ $Date: =
2006-02-10 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A=
/**=0A=
* Check to see if fields are in a valid float range.=0A=
* Fields are not checked if they are disabled.=0A=
* =0A= * @param form The form validation is taking place on.=0A= */=0A= function validateFloatRange(form) {=0A= var isValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= =0A= var oRange =3D eval('new ' + jcv_retrieveFormName(form) + = '_floatRange()');=0A= for (var x in oRange) {=0A= if (!jcv_verifyArrayElement(x, oRange[x])) {=0A= continue;=0A= }=0A= var field =3D form[oRange[x][0]];=0A= if (!jcv_isFieldPresent(field)) {=0A= continue;=0A= }=0A= =0A= if ((field.type =3D=3D 'hidden' ||=0A= field.type =3D=3D 'text' || field.type =3D=3D = 'textarea') &&=0A= (field.value.length > 0)) {=0A= =0A= var fMin =3D parseFloat(oRange[x][2]("min"));=0A= var fMax =3D parseFloat(oRange[x][2]("max"));=0A= var fValue =3D parseFloat(field.value);=0A= if (!(fValue >=3D fMin && fValue <=3D fMax)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oRange[x][1];=0A= isValid =3D false;=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= jcv_handleErrors(fields, focusField);=0A= }=0A= return isValid;=0A= }=0A= =0A= =0A= /*$RCSfile: validateIntRange.js,v $ $Rev: 376673 $ $Date: 2006-02-10 = 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A= /**=0A= * Check to see if fields is in a valid integer range.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= function validateIntRange(form) {=0A= var isValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= =0A= var oRange =3D eval('new ' + jcv_retrieveFormName(form) + = '_intRange()'); =0A= for (var x in oRange) {=0A= if (!jcv_verifyArrayElement(x, oRange[x])) {=0A= continue;=0A= }=0A= var field =3D form[oRange[x][0]];=0A= if (jcv_isFieldPresent(field)) {=0A= var value =3D '';=0A= if (field.type =3D=3D 'hidden' ||=0A= field.type =3D=3D 'text' || field.type =3D=3D = 'textarea' ||=0A= field.type =3D=3D 'radio' ) {=0A= value =3D field.value;=0A= }=0A= if (field.type =3D=3D 'select-one') {=0A= var si =3D field.selectedIndex;=0A= if (si >=3D 0) {=0A= value =3D field.options[si].value;=0A= }=0A= }=0A= if (value.length > 0) {=0A= var iMin =3D parseInt(oRange[x][2]("min"));=0A= var iMax =3D parseInt(oRange[x][2]("max"));=0A= var iValue =3D parseInt(value, 10);=0A= if (!(iValue >=3D iMin && iValue <=3D iMax)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oRange[x][1];=0A= isValid =3D false;=0A= }=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= jcv_handleErrors(fields, focusField);=0A= }=0A= return isValid;=0A= }=0A= =0A= =0A= /*$RCSfile: validateInteger.js,v $ $Rev: 376673 $ $Date: 2006-02-10 = 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A= /**=0A= * Check to see if fields are a valid integer.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= function validateInteger(form) {=0A= var bValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= =0A= var oInteger =3D eval('new ' + jcv_retrieveFormName(form) + = '_IntegerValidations()');=0A= for (var x in oInteger) {=0A= if (!jcv_verifyArrayElement(x, oInteger[x])) {=0A= continue;=0A= }=0A= var field =3D form[oInteger[x][0]];=0A= if (!jcv_isFieldPresent(field)) {=0A= continue;=0A= }=0A= =0A= if ((field.type =3D=3D 'hidden' ||=0A= field.type =3D=3D 'text' ||=0A= field.type =3D=3D 'textarea' ||=0A= field.type =3D=3D 'select-one' ||=0A= field.type =3D=3D 'radio')) {=0A= =0A= var value =3D '';=0A= // get field's value=0A= if (field.type =3D=3D "select-one") {=0A= var si =3D field.selectedIndex;=0A= if (si >=3D 0) {=0A= value =3D field.options[si].value;=0A= }=0A= } else {=0A= value =3D field.value;=0A= }=0A= =0A= if (value.length > 0) {=0A= =0A= if (!jcv_isDecimalDigits(value)) {=0A= bValid =3D false;=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oInteger[x][1];=0A= =0A= } else {=0A= var iValue =3D parseInt(value, 10);=0A= if (isNaN(iValue) || !(iValue >=3D -2147483648 = && iValue <=3D 2147483647)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oInteger[x][1];=0A= bValid =3D false;=0A= }=0A= }=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= jcv_handleErrors(fields, focusField);=0A= }=0A= return bValid;=0A= }=0A= =0A= /**=0A= * Licensed under the Electronic Data Systems Corporation=0A= * End User License Agreement=0A= * you may not use this file except in compliance with the License.=0A= * You may obtain a copy of the License at=0A= *=0A= * http://itpos201/adfgen/license.html=0A= */=0A= =0A= /*$RCSfile: validateExactNumber.js,v $ $Revision: 1.1 $ $Date: = 2010/12/02 09:31:13 $ */=0A= /**=0A= * Check to see if fields must contain a value.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= =0A= function validateExactNumber(form) {=0A= var isValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= var formName =3D form.getAttributeNode("name");=0A= =0A= oNumber =3D eval('new ' + formName.value + '_exactNumber()');=0A= =0A= for (x in oNumber) {=0A= var field =3D form[oNumber[x][0]];=0A= =0A= if (field !=3D undefined && field !=3D null) {=0A= if (( field.type =3D=3D 'text' &&=0A= (field.getAttribute("stype") =3D=3D "number" || = field.getAttribute("stype") =3D=3D "currency")) &&=0A= field.disabled =3D=3D false && field.value !=3D "") {=0A= =0A= //var value =3D parseFloat(field.value);=0A= var valueStr =3D normalizeNumber(field.value);=0A= valueStr =3D valueStr.replace(new RegExp( "(\\+|\\-)", "g" = ), "");=0A= var value =3D parseFloat(valueStr);=0A= jslog.debug("current field:" + field.name + " value:" + = field.value + " parsed to float:" + value);=0A= if (isNaN(value)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oNumber[x][1];=0A= isValid =3D false;=0A= } else {=0A= var numInteri =3D valueStr.indexOf(".");=0A= var numDecimali =3D 0;=0A= if (numInteri =3D=3D -1) {=0A= numInteri =3D valueStr.length;=0A= } else {=0A= numDecimali =3D valueStr.length - numInteri - 1;=0A= }=0A= var intDigit =3D parseInt(oNumber[x][2]("intDigit"));=0A= var decDigit =3D parseInt(oNumber[x][2]("decDigit"));=0A= =0A= jslog.debug("Num Interi:" + numInteri + " - Num = Decimali:" + numDecimali);=0A= =0A= if (numDecimali > decDigit || numInteri > intDigit) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oNumber[x][1];=0A= isValid =3D false;=0A= }=0A= }=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= try {=0A= focusField.focus();=0A= } catch (e) {}=0A= alert(fields.join('\n'));=0A= }=0A= return isValid;=0A= }=0A= =0A= /**=0A= * Licensed under the Electronic Data Systems Corporation=0A= * End User License Agreement=0A= * you may not use this file except in compliance with the License.=0A= * You may obtain a copy of the License at=0A= *=0A= * http://itpos201/adfgen/license.html=0A= */=0A= =0A= /*$RCSfile: validateNumber.js,v $ $Revision: 1.1 $ $Date: 2010/12/02 = 09:31:13 $ */=0A= /**=0A= * Check to see if fields must contain a value.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= =0A= function validateNumber(form) {=0A= var isValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= var formName =3D form.getAttributeNode("name");=0A= =0A= oNumber =3D eval('new ' + formName.value + '_number()');=0A= =0A= for (x in oNumber) {=0A= var field =3D form[oNumber[x][0]];=0A= =0A= if (field !=3D undefined && field !=3D null) {=0A= if (( field.type =3D=3D 'text' &&=0A= (field.getAttribute("stype") =3D=3D "number" || = field.getAttribute("stype") =3D=3D "currency")) &&=0A= field.disabled =3D=3D false && field.value !=3D "") {=0A= =0A= var value =3D normalizeNumber(field.value);=0A= value =3D value.replace(new RegExp( "(\\+|\\-)", "g" ), "");=0A= =0A= jslog.debug("current field:" + field.name + " value:" + = field.value + " normalized to: " + value + " and parsed to float:" + = parseFloat(value));=0A= =0A= if (isNaN(value)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oNumber[x][1];=0A= isValid =3D false;=0A= }=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= try {=0A= focusField.focus();=0A= } catch (e) {}=0A= alert(fields.join('\n'));=0A= }=0A= return isValid;=0A= }=0A= =0A= =0A= /*$RCSfile: validateMask.js,v $ $Rev: 376673 $ $Date: 2006-02-10 = 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A= /**=0A= * Check to see if fields are a valid using a regular expression.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= function validateMask(form) {=0A= var isValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= =0A= var oMasked =3D eval('new ' + jcv_retrieveFormName(form) + = '_mask()'); =0A= for (var x in oMasked) {=0A= if (!jcv_verifyArrayElement(x, oMasked[x])) {=0A= continue;=0A= }=0A= var field =3D form[oMasked[x][0]];=0A= if (!jcv_isFieldPresent(field)) {=0A= continue;=0A= }=0A= =0A= if ((field.type =3D=3D 'hidden' ||=0A= field.type =3D=3D 'text' ||=0A= field.type =3D=3D 'textarea' ||=0A= field.type =3D=3D 'file') &&=0A= (field.value.length > 0)) {=0A= =0A= if (!jcv_matchPattern(field.value, = oMasked[x][2]("mask"))) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oMasked[x][1];=0A= isValid =3D false;=0A= }=0A= }=0A= }=0A= =0A= if (fields.length > 0) {=0A= jcv_handleErrors(fields, focusField);=0A= }=0A= return isValid;=0A= }=0A= =0A= function jcv_matchPattern(value, mask) {=0A= return mask.exec(value);=0A= }=0A= =0A= /**=0A= * Licensed under the Electronic Data Systems Corporation=0A= * End User License Agreement=0A= * you may not use this file except in compliance with the License.=0A= * You may obtain a copy of the License at=0A= *=0A= * http://itpos201/adfgen/license.html=0A= */=0A= =0A= /*$RCSfile: validateNumber.js,v $ $Revision: 1.1 $ $Date: 2010/12/02 = 09:31:13 $ */=0A= /**=0A= * Check to see if fields must contain a value.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= =0A= function validateNumber(form) {=0A= var isValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= var formName =3D form.getAttributeNode("name");=0A= =0A= oNumber =3D eval('new ' + formName.value + '_number()');=0A= =0A= for (x in oNumber) {=0A= var field =3D form[oNumber[x][0]];=0A= =0A= if (field !=3D undefined && field !=3D null) {=0A= if (( field.type =3D=3D 'text' &&=0A= (field.getAttribute("stype") =3D=3D "number" || = field.getAttribute("stype") =3D=3D "currency")) &&=0A= field.disabled =3D=3D false && field.value !=3D "") {=0A= =0A= var value =3D normalizeNumber(field.value);=0A= value =3D value.replace(new RegExp( "(\\+|\\-)", "g" ), "");=0A= =0A= jslog.debug("current field:" + field.name + " value:" + = field.value + " normalized to: " + value + " and parsed to float:" + = parseFloat(value));=0A= =0A= if (isNaN(value)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oNumber[x][1];=0A= isValid =3D false;=0A= }=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= try {=0A= focusField.focus();=0A= } catch (e) {}=0A= alert(fields.join('\n'));=0A= }=0A= return isValid;=0A= }=0A= =0A= /**=0A= * Licensed under the Electronic Data Systems Corporation=0A= * End User License Agreement=0A= * you may not use this file except in compliance with the License.=0A= * You may obtain a copy of the License at=0A= *=0A= * http://itpos201/adfgen/license.html=0A= */=0A= =0A= /*$RCSfile: validateDate.js,v $ $Revision: 1.1 $ $Date: 2010/12/02 = 09:31:13 $ */=0A= /**=0A= * Check to see if fields are a valid date.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= function validateDate(form) {=0A= var bValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= var formName =3D form.getAttributeNode("name");=0A= =0A= oDate =3D eval('new ' + formName.value + '_DateValidations()');=0A= =0A= for (x in oDate) {=0A= var field =3D form[oDate[x][0]];=0A= if (field !=3D undefined && field !=3D null) {=0A= var value =3D field.value;=0A= var datePattern =3D oDate[x][2]("datePatternStrict");=0A= // try loose pattern=0A= if (datePattern =3D=3D null)=0A= datePattern =3D oDate[x][2]("datePattern");=0A= =0A= if (!isValidDateField(field, datePattern)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oDate[x][1];=0A= bValid =3D false;=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= try {=0A= focusField.focus();=0A= } catch (e) {}=0A= alert(fields.join('\n'));=0A= }=0A= return bValid;=0A= }=0A= =0A= function isValidDateField(field, datePattern) {=0A= if (!datePattern) {=0A= datePattern =3D 'dd/MM/yyyy';=0A= }=0A= var value =3D field.value;=0A= if ((field.type =3D=3D 'hidden' ||=0A= field.type =3D=3D 'text' ||=0A= field.type =3D=3D 'textarea') &&=0A= value.length > 0 &&=0A= field.disabled =3D=3D false && value !=3D = DATE_FIELD_DEFAULT_VALUE) =0A= {=0A= var MONTH =3D "MM";=0A= var DAY =3D "dd";=0A= var YEAR =3D "yyyy";=0A= var orderMonth =3D datePattern.indexOf(MONTH);=0A= var orderDay =3D datePattern.indexOf(DAY);=0A= var orderYear =3D datePattern.indexOf(YEAR);=0A= if ((orderDay < orderYear && orderDay > orderMonth)) {=0A= var iDelim1 =3D orderMonth + MONTH.length;=0A= var iDelim2 =3D orderDay + DAY.length;=0A= var delim1 =3D datePattern.substring(iDelim1, iDelim1 + 1);=0A= var delim2 =3D datePattern.substring(iDelim2, iDelim2 + 1);=0A= if (iDelim1 =3D=3D orderDay && iDelim2 =3D=3D orderYear) {=0A= dateRegexp =3D new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");=0A= } else if (iDelim1 =3D=3D orderDay) {=0A= dateRegexp =3D new RegExp("^(\\d{2})(\\d{2})[" + delim2 = + "](\\d{4})$");=0A= } else if (iDelim2 =3D=3D orderYear) {=0A= dateRegexp =3D new RegExp("^(\\d{2})[" + delim1 + = "](\\d{2})(\\d{4})$");=0A= } else {=0A= dateRegexp =3D new RegExp("^(\\d{2})[" + delim1 + = "](\\d{2})[" + delim2 + "](\\d{4})$");=0A= }=0A= var matched =3D dateRegexp.exec(value);=0A= if (matched !=3D null) {=0A= if (!isValidDate(matched[2], matched[1], matched[3])) {=0A= return false;=0A= }=0A= } else {=0A= return false;=0A= }=0A= } else if ((orderMonth < orderYear && orderMonth > orderDay)) {=0A= var iDelim1 =3D orderDay + DAY.length;=0A= var iDelim2 =3D orderMonth + MONTH.length;=0A= var delim1 =3D datePattern.substring(iDelim1, iDelim1 + 1);=0A= var delim2 =3D datePattern.substring(iDelim2, iDelim2 + 1);=0A= if (iDelim1 =3D=3D orderMonth && iDelim2 =3D=3D orderYear) {=0A= dateRegexp =3D new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");=0A= } else if (iDelim1 =3D=3D orderMonth) {=0A= dateRegexp =3D new RegExp("^(\\d{2})(\\d{2})[" + delim2 = + "](\\d{4})$");=0A= } else if (iDelim2 =3D=3D orderYear) {=0A= dateRegexp =3D new RegExp("^(\\d{2})[" + delim1 + = "](\\d{2})(\\d{4})$");=0A= } else {=0A= dateRegexp =3D new RegExp("^(\\d{2})[" + delim1 + = "](\\d{2})[" + delim2 + "](\\d{4})$");=0A= }=0A= var matched =3D dateRegexp.exec(value);=0A= if (matched !=3D null) {=0A= if (!isValidDate(matched[1], matched[2], matched[3])) {=0A= return false;=0A= }=0A= } else {=0A= return false;=0A= }=0A= } else if ((orderMonth > orderYear && orderMonth < orderDay)) {=0A= var iDelim1 =3D orderYear + YEAR.length;=0A= var iDelim2 =3D orderMonth + MONTH.length;=0A= var delim1 =3D datePattern.substring(iDelim1, iDelim1 + 1);=0A= var delim2 =3D datePattern.substring(iDelim2, iDelim2 + 1);=0A= if (iDelim1 =3D=3D orderMonth && iDelim2 =3D=3D orderDay) {=0A= dateRegexp =3D new RegExp("^(\\d{4})(\\d{2})(\\d{2})$");=0A= } else if (iDelim1 =3D=3D orderMonth) {=0A= dateRegexp =3D new RegExp("^(\\d{4})(\\d{2})[" + delim2 = + "](\\d{2})$");=0A= } else if (iDelim2 =3D=3D orderDay) {=0A= dateRegexp =3D new RegExp("^(\\d{4})[" + delim1 + = "](\\d{2})(\\d{2})$");=0A= } else {=0A= dateRegexp =3D new RegExp("^(\\d{4})[" + delim1 + = "](\\d{2})[" + delim2 + "](\\d{2})$");=0A= }=0A= var matched =3D dateRegexp.exec(value);=0A= if (matched !=3D null) {=0A= if (!isValidDate(matched[3], matched[2], matched[1])) {=0A= return false;=0A= }=0A= } else {=0A= return false;=0A= }=0A= } else {=0A= return false;=0A= }=0A= }=0A= return true;=0A= }=0A= =0A= function isValidDate(day, month, year) {=0A= if (month < 1 || month > 12) {=0A= return false;=0A= }=0A= if (day < 1 || day > 31) {=0A= return false;=0A= }=0A= if ((month =3D=3D 4 || month =3D=3D 6 || month =3D=3D 9 || month = =3D=3D 11) &&=0A= (day =3D=3D 31)) {=0A= return false;=0A= }=0A= if (month =3D=3D 2) {=0A= var leap =3D (year % 4 =3D=3D 0 &&=0A= (year % 100 !=3D 0 || year % 400 =3D=3D 0));=0A= if (day > 29 || (day =3D=3D 29 && !leap)) {=0A= return false;=0A= }=0A= }=0A= return true;=0A= }=0A= =0A= =0A= /*$RCSfile: validateFloat.js,v $ $Rev: 376673 $ $Date: 2006-02-10 = 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A= /**=0A= * Check to see if fields are a valid float.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= function validateFloat(form) {=0A= var bValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= =0A= var oFloat =3D eval('new ' + jcv_retrieveFormName(form) + = '_FloatValidations()');=0A= for (var x in oFloat) {=0A= if (!jcv_verifyArrayElement(x, oFloat[x])) {=0A= continue;=0A= }=0A= var field =3D form[oFloat[x][0]];=0A= if (!jcv_isFieldPresent(field)) {=0A= continue;=0A= }=0A= =0A= if ((field.type =3D=3D 'hidden' ||=0A= field.type =3D=3D 'text' ||=0A= field.type =3D=3D 'textarea' ||=0A= field.type =3D=3D 'select-one' ||=0A= field.type =3D=3D 'radio')) {=0A= =0A= var value =3D '';=0A= // get field's value=0A= if (field.type =3D=3D "select-one") {=0A= var si =3D field.selectedIndex;=0A= if (si >=3D 0) {=0A= value =3D field.options[si].value;=0A= }=0A= } else {=0A= value =3D field.value;=0A= }=0A= =0A= if (value.length > 0) {=0A= // remove '.' before checking digits=0A= var tempArray =3D value.split('.');=0A= //Strip off leading '0'=0A= var zeroIndex =3D 0;=0A= var joinedString=3D tempArray.join('');=0A= while (joinedString.charAt(zeroIndex) =3D=3D '0') {=0A= zeroIndex++;=0A= }=0A= var noZeroString =3D = joinedString.substring(zeroIndex,joinedString.length);=0A= =0A= if (!jcv_isAllDigits(noZeroString) || = tempArray.length > 2) {=0A= bValid =3D false;=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oFloat[x][1];=0A= =0A= } else {=0A= var iValue =3D parseFloat(value);=0A= if (isNaN(iValue)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oFloat[x][1];=0A= bValid =3D false;=0A= }=0A= }=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= jcv_handleErrors(fields, focusField);=0A= }=0A= return bValid;=0A= }=0A= =0A= /**=0A= * Licensed under the Electronic Data Systems Corporation=0A= * End User License Agreement=0A= * you may not use this file except in compliance with the License.=0A= * You may obtain a copy of the License at=0A= *=0A= * http://itpos201/adfgen/license.html=0A= */=0A= =0A= /*$RCSfile: validateNumber.js,v $ $Revision: 1.1 $ $Date: 2010/12/02 = 09:31:13 $ */=0A= /**=0A= * Check to see if fields must contain a value.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= =0A= function validateNumber(form) {=0A= var isValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= var formName =3D form.getAttributeNode("name");=0A= =0A= oNumber =3D eval('new ' + formName.value + '_number()');=0A= =0A= for (x in oNumber) {=0A= var field =3D form[oNumber[x][0]];=0A= =0A= if (field !=3D undefined && field !=3D null) {=0A= if (( field.type =3D=3D 'text' &&=0A= (field.getAttribute("stype") =3D=3D "number" || = field.getAttribute("stype") =3D=3D "currency")) &&=0A= field.disabled =3D=3D false && field.value !=3D "") {=0A= =0A= var value =3D normalizeNumber(field.value);=0A= value =3D value.replace(new RegExp( "(\\+|\\-)", "g" ), "");=0A= =0A= jslog.debug("current field:" + field.name + " value:" + = field.value + " normalized to: " + value + " and parsed to float:" + = parseFloat(value));=0A= =0A= if (isNaN(value)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oNumber[x][1];=0A= isValid =3D false;=0A= }=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= try {=0A= focusField.focus();=0A= } catch (e) {}=0A= alert(fields.join('\n'));=0A= }=0A= return isValid;=0A= }=0A= =0A= =0A= /*$RCSfile: validateCreditCard.js,v $ $Rev: 376673 $ $Date: = 2006-02-10 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A= /**=0A= * Check to see if fields are a valid creditcard number based on Luhn = checksum.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= function validateCreditCard(form) {=0A= var bValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= =0A= var oCreditCard =3D eval('new ' + jcv_retrieveFormName(form) + = '_creditCard()');=0A= =0A= for (var x in oCreditCard) {=0A= if (!jcv_verifyArrayElement(x, oCreditCard[x])) {=0A= continue;=0A= }=0A= var field =3D form[oCreditCard[x][0]];=0A= if (!jcv_isFieldPresent(field)) {=0A= continue;=0A= }=0A= if ((field.type =3D=3D 'text' ||=0A= field.type =3D=3D 'textarea') &&=0A= (field.value.length > 0)) {=0A= if (!jcv_luhnCheck(field.value)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oCreditCard[x][1];=0A= bValid =3D false;=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= jcv_handleErrors(fields, focusField);=0A= }=0A= return bValid;=0A= }=0A= =0A= /**=0A= * Checks whether a given credit card number has a valid Luhn = checksum.=0A= * This allows you to spot most randomly made-up or garbled credit = card numbers immediately.=0A= * Reference: http://www.speech.cs.cmu.edu/~sburke/pub/luhn_lib.html=0A= */=0A= function jcv_luhnCheck(cardNumber) {=0A= if (jcv_isLuhnNum(cardNumber)) {=0A= var no_digit =3D cardNumber.length;=0A= var oddoeven =3D no_digit & 1;=0A= var sum =3D 0;=0A= for (var count =3D 0; count < no_digit; count++) {=0A= var digit =3D parseInt(cardNumber.charAt(count));=0A= if (!((count & 1) ^ oddoeven)) {=0A= digit *=3D 2;=0A= if (digit > 9) digit -=3D 9;=0A= };=0A= sum +=3D digit;=0A= };=0A= if (sum =3D=3D 0) return false;=0A= if (sum % 10 =3D=3D 0) return true;=0A= };=0A= return false;=0A= }=0A= =0A= function jcv_isLuhnNum(argvalue) {=0A= argvalue =3D argvalue.toString();=0A= if (argvalue.length =3D=3D 0) {=0A= return false;=0A= }=0A= for (var n =3D 0; n < argvalue.length; n++) {=0A= if ((argvalue.substring(n, n+1) < "0") ||=0A= (argvalue.substring(n,n+1) > "9")) {=0A= return false;=0A= }=0A= }=0A= return true;=0A= }=0A= =0A= =0A= /*$RCSfile: validateShort.js,v $ $Rev: 376673 $ $Date: 2006-02-10 = 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A= /**=0A= * Check to see if fields are a valid short.=0A= * Fields are not checked if they are disabled.=0A= *
=0A= * @param form The form validation is taking place on.=0A= */=0A= function validateShort(form) {=0A= var bValid =3D true;=0A= var focusField =3D null;=0A= var i =3D 0;=0A= var fields =3D new Array();=0A= =0A= var oShort =3D eval('new ' + jcv_retrieveFormName(form) + = '_ShortValidations()');=0A= =0A= for (var x in oShort) {=0A= if (!jcv_verifyArrayElement(x, oShort[x])) {=0A= continue;=0A= }=0A= var field =3D form[oShort[x][0]];=0A= if (!jcv_isFieldPresent(field)) {=0A= continue;=0A= }=0A= =0A= if ((field.type =3D=3D 'hidden' ||=0A= field.type =3D=3D 'text' ||=0A= field.type =3D=3D 'textarea' ||=0A= field.type =3D=3D 'select-one' ||=0A= field.type =3D=3D 'radio')) {=0A= =0A= var value =3D '';=0A= // get field's value=0A= if (field.type =3D=3D "select-one") {=0A= var si =3D field.selectedIndex;=0A= if (si >=3D 0) {=0A= value =3D field.options[si].value;=0A= }=0A= } else {=0A= value =3D field.value;=0A= }=0A= =0A= if (value.length > 0) {=0A= if (!jcv_isDecimalDigits(value)) {=0A= bValid =3D false;=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oShort[x][1];=0A= =0A= } else {=0A= =0A= var iValue =3D parseInt(value, 10);=0A= if (isNaN(iValue) || !(iValue >=3D -32768 && = iValue <=3D 32767)) {=0A= if (i =3D=3D 0) {=0A= focusField =3D field;=0A= }=0A= fields[i++] =3D oShort[x][1];=0A= bValid =3D false;=0A= }=0A= }=0A= }=0A= }=0A= }=0A= if (fields.length > 0) {=0A= jcv_handleErrors(fields, focusField);=0A= }=0A= return bValid;=0A= }=0A= =0A= =0A= /*$RCSfile: validateMaxLength.js,v $ $Rev: 376673 $ $Date: = 2006-02-10 13:42:31 +0000 (Fri, 10 Feb 2006) $ */=0A= /**=0A= * A field is considered valid if less than the specified maximum.=0A= * Fields are not checked if they are disabled.=0A= *
=0A=
* Caution: Using validateMaxLength
on =
a password field in a =0A=
* login page gives unnecessary information away to hackers. While =
it only slightly=0A=
* weakens security, we suggest using it only when modifying a =
password.
=0A=
* @param form The form validation is taking place on.=0A=
*/=0A=
function validateEmail(form) {=0A=
var bValid =3D true;=0A=
var focusField =3D null;=0A=
var i =3D 0;=0A=
var fields =3D new Array();=0A=
=0A=
var oEmail =3D eval('new ' + jcv_retrieveFormName(form) + =
'_email()');=0A=
=0A=
for (var x in oEmail) {=0A=
if (!jcv_verifyArrayElement(x, oEmail[x])) {=0A=
continue;=0A=
}=0A=
var field =3D form[oEmail[x][0]];=0A=
if (!jcv_isFieldPresent(field)) {=0A=
continue;=0A=
}=0A=
if ((field.type =3D=3D 'hidden' || =0A=
field.type =3D=3D 'text' ||=0A=
field.type =3D=3D 'textarea') &&=0A=
(field.value.length > 0)) {=0A=
if (!jcv_checkEmail(field.value)) {=0A=
if (i =3D=3D 0) {=0A=
focusField =3D field;=0A=
}=0A=
fields[i++] =3D oEmail[x][1];=0A=
bValid =3D false;=0A=
}=0A=
}=0A=
}=0A=
if (fields.length > 0) {=0A=
jcv_handleErrors(fields, focusField);=0A=
}=0A=
return bValid;=0A=
}=0A=
=0A=
/**=0A=
* Reference: Sandeep V. Tamhankar (stamhankar@hotmail.com),=0A=
* http://javascript.internet.com=0A=
*/=0A=
function jcv_checkEmail(emailStr) {=0A=
if (emailStr.length =3D=3D 0) {=0A=
return true;=0A=
}=0A=
// TLD checking turned off by default=0A=
var checkTLD=3D0;=0A=
var =
knownDomsPat=3D/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|inf=
o|pro|museum)$/;=0A=
var emailPat=3D/^(.+)@(.+)$/;=0A=
var specialChars=3D"\\(\\)><@,;:\\\\\\\"\\.\\[\\]";=0A=
var validChars=3D"\[^\\s" + specialChars + "\]";=0A=
var quotedUser=3D"(\"[^\"]*\")";=0A=
var =
ipDomainPat=3D/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;=0A=
var atom=3DvalidChars + '+';=0A=
var word=3D"(" + atom + "|" + quotedUser + ")";=0A=
var userPat=3Dnew RegExp("^" + word + "(\\." + word + ")*$");=0A=
var domainPat=3Dnew RegExp("^" + atom + "(\\." + atom +")*$");=0A=
var matchArray=3DemailStr.match(emailPat);=0A=
if (matchArray=3D=3Dnull) {=0A=
return false;=0A=
}=0A=
var user=3DmatchArray[1];=0A=
var domain=3DmatchArray[2];=0A=
for (i=3D0; i =0A=
* @param form The form validation is taking place on.=0A=
*/=0A=
=0A=
function validateRequired(form) {=0A=
var isValid =3D true;=0A=
var focusField =3D null;=0A=
var i =3D 0;=0A=
var fields =3D new Array();=0A=
var formName =3D form.getAttributeNode("name");=0A=
=0A=
oRequired =3D eval('new ' + formName.value + '_required()');=0A=
=0A=
for (x in oRequired) {=0A=
var field =3D form[oRequired[x][0]];=0A=
=0A=
if (field !=3D undefined && field !=3D null) {=0A=
if ((field.type =3D=3D 'hidden' ||=0A=
field.type =3D=3D 'text' ||=0A=
field.type =3D=3D 'textarea' ||=0A=
field.type =3D=3D 'file' ||=0A=
field.type =3D=3D 'checkbox' ||=0A=
field.type =3D=3D 'select-one' ||=0A=
field.type =3D=3D 'password') &&=0A=
field.disabled =3D=3D false) {=0A=
=0A=
var value =3D '';=0A=
// get field's value=0A=
if (field.type =3D=3D "select-one") {=0A=
var si =3D field.selectedIndex;=0A=
if (si >=3D 0) {=0A=
value =3D field.options[si].value;=0A=
}=0A=
} else if (field.type =3D=3D 'checkbox') {=0A=
if (field.checked) {=0A=
value =3D field.value;=0A=
}=0A=
} else {=0A=
value =3D field.value;=0A=
}=0A=
=0A=
if (trim(value).length =3D=3D 0 || value =3D=3D =
'__/__/____') {=0A=
=0A=
if (i =3D=3D 0) {=0A=
focusField =3D field;=0A=
}=0A=
fields[i++] =3D oRequired[x][1];=0A=
isValid =3D false;=0A=
}=0A=
} else if (field.type =3D=3D "select-multiple") {=0A=
var numOptions =3D field.options.length;=0A=
lastSelected =3D -1;=0A=
for (loop =3D numOptions - 1; loop >=3D 0; loop--) {=0A=
if (field.options[loop].selected) {=0A=
lastSelected =3D loop;=0A=
value =3D field.options[loop].value;=0A=
break;=0A=
}=0A=
}=0A=
if (lastSelected < 0 || trim(value).length =3D=3D 0) {=0A=
if (i =3D=3D 0) {=0A=
focusField =3D field;=0A=
}=0A=
fields[i++] =3D oRequired[x][1];=0A=
isValid =3D false;=0A=
}=0A=
} else if ((field.length > 0) && (field[0].type =3D=3D 'radio' =
|| field[0].type =3D=3D 'checkbox')) {=0A=
isChecked =3D -1;=0A=
for (loop =3D 0; loop < field.length; loop++) {=0A=
if (field[loop].checked) {=0A=
isChecked =3D loop;=0A=
break;=0A=
// only one needs to be checked=0A=
}=0A=
}=0A=
if (isChecked < 0) {=0A=
if (i =3D=3D 0) {=0A=
focusField =3D field[0];=0A=
}=0A=
fields[i++] =3D oRequired[x][1];=0A=
isValid =3D false;=0A=
}=0A=
}=0A=
}=0A=
}=0A=
if (fields.length > 0) {=0A=
try {=0A=
focusField.focus();=0A=
} catch (e) {}=0A=
alert(fields.join('\n'));=0A=
}=0A=
return isValid;=0A=
}=0A=
=0A=
// Trim whitespace from left and right sides of s.=0A=
function trim(s) {=0A=
return s.replace(/^\s*/, "").replace(/\s*$/, "");=0A=
}=0A=
=0A=
=0A=
------=_NextPart_000_0000_01D36E89.B6280F90--