在Acrobat的Javascript中存储和检索数据

在Acrobat的Javascript中存储和检索数据,javascript,pdf,Javascript,Pdf,我有这个PDF表单,我正在编写脚本,我有一个快速的问题 我有一组复选框,如果选中某个复选框,我想存储数据并清除复选框,如果未选中,我想将值返回到以前的状态 这是我目前掌握的代码: if (groundingNV.value == "Yes"){ groundingGroundRodStore = groundingGroundRod.value; groundingWaterPipeStore = groundingWaterPipe.value;

我有这个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语句的不同部分设置回值,但它一直在做相同的事情

我理解为什么它们会被卡在激活状态,但我不知道如何让它们以我所期待的方式运行

任何意见都将不胜感激