首页 > 解决方案 > 在 Javascript 中为 Acrobat 存储和检索数据

问题描述

我有这个 PDF 表单,我正在编写脚本并有一个快速的问题。

我有一组复选框,如果选中某个复选框,我想存储数据并清除复选框,如果未选中,我想将值返回到以前的状态。

在此处输入图像描述

这是我到目前为止的代码:

if (groundingNV.value == "Yes"){

    groundingGroundRodStore = groundingGroundRod.value;
    groundingWaterPipeStore = groundingWaterPipe.value;
    setNotRequired(["groundingGroundRod", "groundingWaterPipe"]);
    clear(["groundingGroundRod", "groundingWaterPipe"]); 

} else if (groundingGroundRod.value == "Yes" || groundingWaterPipe.value == "Yes"){

    setNotRequired(["groundingGroundRod", "groundingWaterPipe", "groundingNV"]);

} else if (groundingNV.value == "Off"){

    groundingGroundRod.value = groundingGroundRodStore;
    groundingWaterPipe.value = groundingWaterPipeStore;

} else {

    setRequired(["groundingGroundRod", "groundingWaterPipe", "groundingNV"]); 

}

目前,如果我选中“groundingNV”框,其他值将被存储,如果未选中,它们将返回正确的位置;然而,他们然后被困在这里,我永远无法把他们带回来。

我尝试在 if else 语句的不同部分重新设置值,但它一直在做同样的事情。

我理解为什么它们会被卡住,但我不知道如何使它们以我正在寻找的方式运行。

任何投入将不胜感激!

标签: javascriptpdf

解决方案


推荐阅读