【问题标题】:Check all checkboxes on spawned page template检查生成的页面模板上的所有复选框
【发布时间】:2020-06-18 02:34:18
【问题描述】:

我创建了一个带有页面模板的表单,当用户选择表单上的复选框时会生成这些模板。 其中一个页面模板有一个复选框列表,后跟“全选”复选框。选中此项后,所有复选框都会自动选中。 这在页面模板上工作正常,但是当生成模板时,“全选”复选框之间的“链接”被破坏,并且没有选择其他复选框。 这是我目前拥有的 javascript:

if(event.target.isBoxChecked(0))
{// Perform actions when checked
   this.getField(“A”).checkThisBox(0,true);
   this.getField(“B”).checkThisBox(0,true);
       this.getField(“C”).checkThisBox(0,true);
       this.getField(“D”).checkThisBox(0,true);
       this.getField(“E”).checkThisBox(0,true);
       this.getField(“F”).checkThisBox(0,true);
       this.getField(“G”).checkThisBox(0,true);
    }
else
{// Perform actions when unchecked
   this.getField(“A”).checkThisBox(0,false);
   this.getField(“B”).checkThisBox(0,false);
       this.getField(“C”).checkThisBox(0,false);
       this.getField(“D”).checkThisBox(0,false);
       this.getField(“E”).checkThisBox(0,false);
       this.getField(“F”).checkThisBox(0,false);
       this.getField(“G”).checkThisBox(0,false);
}

【问题讨论】:

    标签: javascript forms templates pdf checkbox


    【解决方案1】:

    感谢大家的意见。 我找到了一个完美运行的线程:

    var cPreFix = "";
    // get prefix elements for spawned pages;
    var aFieldName = event.target.name.split(".");
    if(aFieldName.length > 2)
    {
    // first 2 elements of name array makeup the prefix for fields on a spawned page;
    cPreFix = aFieldName[0] + "." + aFieldName[1] + ".";
    }
    //if/else conditional statement
    if(event.target.isBoxChecked(0))
    {// Perform actions when checked
      this.getField(cPreFix +"Option1").checkThisBox(0,true);
      this.getField(cPreFix +"Option2").checkThisBox(0,true);

      this.getField(cPreFix +"Option3").checkThisBox(0,true);

    else
    {// Perform actions when unchecked
      this.getField(cPreFix +"Option1").checkThisBox(0,false);
      this.getField(cPreFix +"Option2").checkThisBox(0,false);

      this.getField(cPreFix +"Option3").checkThisBox(0,false);
    }
    

    感谢 adobe 社区论坛的 gkaiseril: acrobat/how-do-i-have-calculated-scripts-adjust-when-i-spawn-a-new-page-from-a-template/ [https://community.adobe.com/t5/acrobat/how-do-i-have-calculated-scripts-adjust-when-i-spawn-a-new-page-from-a-template/m-p/9902135 ?page=1]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-06
      • 1970-01-01
      • 2011-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多