当表单字段失去焦点时,我调用了一个javascript函数。所以我要做的是,如果我勾选了required this field as required字段,它周围会有一个红色的边框,当字段中有值时,我可以编写一个脚本来删除required选项吗?
var thisValue = this.getField("companyName").value;
var regexLetter = /[A-Z]+$/;
var Icon = "0"; //0 — Error (default) // 1 — Warning // 2 — Question // 3 — Status
var Type = "0"; //0 — OK (default) // 1 — OK, Cancel // 2 — Yes, No // 3 — Yes, No, Cancel
if (thisValue == ""){
app.alert({
cMsg:"this is an warning",
cTitle: "thsi is title",
nIcon: Icon,
nType: Type
})
} else if(!regexLetter.test(thisValue)){
app.alert('Type alphanumeric character');
}发布于 2013-05-12 13:28:42
这将是相当晚的,但我在我的文档中是这样做的:
var _companyName = this.getField("CompanyName");
_companyName.required = (_companyName.value === "");您还可以施加其他依赖项,例如:
var _companyName = this.getField("CompanyName"),
_companyLicense = this.getField("CompanyLicense");
_companyLicense = ((_companyLicense === "")
&& (_companyName !== ""));将脚本拆分为几个文件可能会有所帮助。我使用一个包含绝大多数逻辑的“共享”脚本和一个“特定”脚本对每个单独的文档进行取整。此外,确保在添加脚本时只按正确的顺序命名为1、2、3等,否则Acrobat将是愚蠢的。希望这对你有帮助。
https://stackoverflow.com/questions/12927066
复制相似问题