function IsBlank(p_strFormName, p_strFieldName, p_strErrorMessage) { var objFormField = eval("document." + p_strFormName + "." + p_strFieldName); if (objFormField != null) { if (Trim(objFormField.value) == "") { return "\n - " + p_strErrorMessage; } else { return ""; } } } function IsAlphabetic(p_strFormName, p_strFieldName, p_strErrorMessage) { var objFormField = eval("document." + p_strFormName + "." + p_strFieldName); if (objFormField != null) { var strValue = new String(Trim(objFormField.value)); if (strValue.search(/[^A-Z\.\s]/gi) != -1) { return "\n - " + p_strErrorMessage; } else { return ""; } } } function IsAlphaNumeric(p_strFormName, p_strFieldName, p_strErrorMessage) { var objFormField = eval("document." + p_strFormName + "." + p_strFieldName); if (objFormField != null) { var strValue = new String(Trim(objFormField.value)); if (strValue.search(/[^A-Z0-9\.\s]/gi) != -1) { return "\n - " + p_strErrorMessage; } else { return ""; } } } function IsNumeric(p_strFormName, p_strFieldName, p_strErrorMessage) { var objFormField = eval("document." + p_strFormName + "." + p_strFieldName); if (objFormField != null) { var strValue = new String(Trim(objFormField.value)); if (strValue.search(/[^0-9\.\s]/gi) != -1) { return "\n - " + p_strErrorMessage; } else { return ""; } } } function IsEmail(p_strFormName, p_strFieldName, p_strErrorMessage) { var objFormField = eval("document." + p_strFormName + "." + p_strFieldName); if (objFormField != null) { var strValue = new String(Trim(objFormField.value)); if (strValue.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/gi) == -1) { return "\n - " + p_strErrorMessage; } else { return ""; } } } function IsURL(p_strFormName, p_strFieldName, p_strErrorMessage) { var objFormField = eval("document." + p_strFormName + "." + p_strFieldName); if (objFormField != null) { var strValue = new String(Trim(objFormField.value)); if (strValue.search(/^(ftp|http|https)\:\/\/\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([\/\.\-\?\&\%\#]\w+)*\/?$/gi) == -1) { return "\n - " + p_strErrorMessage; } else { return ""; } } } function IsValidFile(p_strFormName, p_strFieldName, p_strFileList, p_strErrorMessage) { var objFormField = eval("document." + p_strFormName + "." + p_strFieldName); if (objFormField != null) { var strValue = new String(Trim(objFormField.value)); if (strValue.search(eval("/\.(" + p_strFileList + ")$/gi")) == -1) { return "\n - " + p_strErrorMessage; } else { return ""; } } } function IsDate(p_strFormName, p_strYearFieldName, p_strMonthFieldName, p_strDayFieldName, p_strErrorMessage) { var objFormYearField = eval("document." + p_strFormName + "." + p_strYearFieldName); var objFormMonthField = eval("document." + p_strFormName + "." + p_strMonthFieldName); var objFormDayField = eval("document." + p_strFormName + "." + p_strDayFieldName); if (objFormYearField != null && objFormMonthField != null && objFormDayField != null) { var dtNewDate = new Date(); dtNewDate.setFullYear(objFormYearField.value); dtNewDate.setMonth(objFormMonthField.value - 1); dtNewDate.setDate(objFormDayField.value); if (dtNewDate.getYear() != objFormYearField.value || dtNewDate.getMonth() != objFormMonthField.value - 1 || dtNewDate.getDate() != objFormDayField.value) { return "\n - " + p_strErrorMessage; } else { return ""; } } } function Trim(p_strValue) { var strValue = new String(p_strValue); strValue = strValue.replace(/^\s+/gi, ""); strValue = strValue.replace(/\s+$/gi, ""); return strValue; }