|
|
函数格式:
notRepeated (fieldName, tableName, description, andSQL)
函数说明:
fieldName: 字段名
tableName: 对比字段名
description: 描述
andSQL:添加额外条件(可不传)
示例:
实现notRepeated (fieldName, tableName, description, andSQL)函数的应用
function notRepeated(fieldName, tableName, description, andSQL) {
var doc = $CURRDOC.getCurrDoc();
var returnStr = "";
var dql = "$formname='" + tableName + "' and " + fieldName + "='" + getItemValue(fieldName) + "'";
if (andSQL) {
dql += " and " + andSQL;
}
if (doc != null) {
dql += " and $id<>'" + doc.getId() + "'";
}
var count = countByDQL(dql);
if (count > 0) {
returnStr = "'" + description + "' 不能重复!";
}
return returnStr;
}
调用
#include " validationlib";
notRepeated (" fieldName"," tableName"," description"," andSQL"); |
|