Acrobat文档级Javascript设置/清除多个文本字段

时间:2018-03-22 16:55:09

标签: javascript acrobat

我有一个带有各种命名文本字段的表单,它可以带有0到4之间的值。目前,我有一个文档级脚本,如果存在或不存在值,它将设置strokeColor。麻烦的是,这与设置文本字段的初始装饰的脚本相冲突,并且一旦在任何一个字段中放置值,就会导致所有字段删除它们的装饰。如何使这项工作一次只能影响一个领域,而不是全部? JavaScript不是我通常处理的,所以这是一个很多的试验和错误。

此外,还有许多带有各种名称的复选框,当"清除表格时,会删除fillColor和strokeColor。按下按钮。如何防止这种情况或将所有复选框设置回其原始,空白,边框和背景填充状态?

我知道这两个剧本相互矛盾,这就是我寻求帮助的原因。我无法弄清楚如何使这项工作,再次,这不是我经验丰富的主要语言。

我的功能是清除文本字段,与Blur一起使用:

function clearReqADLDecoration() {
if (event.target.value == "") {
// Background light blue when blank
    event.target.required = true;
    event.target.fillColor = event.value ? color.transparent : ["RGB", 236/255 , 251/255 , 255/255,];
    event.target.strokeColor = event.value ? color.transparent : color.red;
} else {
// Background removed when text present
    event.target.required = false;
    event.target.fillColor = event.value ? color.transparent : color.transparent;
    event.target.strokeColor = event.value ? color.transparent : color.transparent;
}
}

我的功能是设置初始字段背景颜色,用作自定义计算:

function setReqADLDecoration() {
if (event.target.value == "") {
// Background light blue when blank
    event.target.required = true;
    event.target.strokeColor = event.value ? color.transparent : color.transparent;
    event.target.fillColor = event.value ? color.transparent : ["RGB", 236/255 , 251/255 , 255/255,];
} else {
// Background removed when text present
    event.target.required = false;
    event.target.strokeColor = event.value ? color.transparent : color.transparent;
    event.target.fillColor = event.value ? color.transparent : color.transparent;
}
}

0 个答案:

没有答案
相关问题