繁体   English   中英

获取复选框数据表单用户并在Adobe Acrobat中检查动态图章

[英]Getting checkbox data form user and checking dynamic stamp in Adobe Acrobat

我正在Acrobat中制作动态邮票。 它具有5个复选框和三个文本字段。 我的文本字段很好,弹出一个对话框,询问“名称”,“项目”,他们将其填写,然后填写字段。 另一个文本框是我动态提取的日期。 复选框很麻烦。 我知道用以下方法检查它们:

var f = this.getField("cb10");
f.checkThisBox(0,true);

放我不知道如何在对话框中包括选择并将它们链接到图章框。 任何帮助,不胜感激。

编辑

我想出了这个:

    var DiaBox =
{

result:"cancel",
DoDialog: function(){return app.execDialog(this);},
bChk1:false,
bChk2:false,
bChk3:false,
bChk4:false,
bChk5:false,
stredt1:"",
stredt2:"",
initialize: function(dialog)
{
var dlgInit = 
{
"Chk1": this.bChk1,
"Chk2": this.bChk2,
"Chk3": this.bChk3,
"Chk4": this.bChk4,
"Chk5": this.bChk5,
"edt1": this.stredt1,
"edt2": this.stredt2,
};
dialog.load(dlgInit);
},
commit: function(dialog)
{
var oRslt = dialog.store();
this.bChk1 = oRslt["Chk1"];
this.bChk2 = oRslt["Chk2"];
this.bChk3 = oRslt["Chk3"];
this.bChk4 = oRslt["Chk4"];
this.bChk5 = oRslt["Chk5"];
this.byName = oRslt["edt1"];
this.projNum = oRslt["edt2"];
},
description:
{
name: "Stamp",
elements:
[
{
type: "view",
elements:
[
{
type: "view",
char_height: 10,
elements:
[
{
type: "static_text",
item_id: "stat",
name: "Check only ONE box:",
width: 152,
height: 23,
char_width: 15,
alignment: "align_fill",
font: "dialog",
},
{
type: "check_box",
item_id: "Chk1",
name: "Approved",
},
{
type: "check_box",
item_id: "Chk2",
name: "Approved as Noted - Proceed",
},
{
type: "check_box",
item_id: "Chk3",
name: "Revise and Resubmit",
},
{
type: "check_box",
item_id: "Chk4",
name: "Not a required submittal - not Reviewed",
},
{
type: "check_box",
item_id: "Chk5",
name: "Rejected - Do Not Use",
},
{
type: "static_text",
item_id: "sta1",
name: "Project Number",
alignment: "align_row",
},
{
type: "edit_text",
item_id: "edt1",
char_width: 20,
char_height: 6,
alignment: "align_left",
},
{
type: "static_text",
item_id: "sta2",
name: "Name:",
},
{
type: "edit_text",
item_id: "edt2",
char_width: 20,
alignment: "align_left",
font: "palette",
},
]
},
{
type: "ok_cancel",
},
]
},
]
}
};

// Example Code
DiaBox.bChk1 = false;
DiaBox.bChk2 = false;
DiaBox.bChk3 = false;
DiaBox.bChk4 = false;
DiaBox.bChk5 = false;
DiaBox.stredt1 = "";
DiaBox.stredt2 = "";

if(event.source.forReal && (event.source.stampName == "#bsiloE85pqFs4ntcdBQCMC"))
{
  if ("ok" == app.execDialog(DiaBox))
  {
    var cMsg = DiaBox.byName;
    event.value = "Project # " + cMsg;
    event.source.source.info.exhibit = cMsg;

    cMsg = "By: " + DiaBox.projNum;
    this.getField("byNameField").value = cMsg;

    this.getField("cbx1").checkThisBox(0, DiaBox.bChk1);
    this.getField("cbx2").checkThisBox(0, DiaBox.bChk2);
    this.getField("cbx3").checkThisBox(0, DiaBox.bChk3);
    this.getField("cbx4").checkThisBox(0, DiaBox.bChk4);
    this.getField("cbx5").checkThisBox(0, DiaBox.bChk5);
  }
}

它在Acrobat中很好用,但是在阅读器中,不会填充“按名称”字段和复选框。 我无法在阅读器中获得调试器,因此在跟踪问题时遇到问题。 有人可以看到吗?

由于这已经出现在Google搜索的顶部,因此,我将向您展示我所做的事情,虽然它不是完美的或优雅的,但它可以工作。

{
name: "Stamp",
elements:
[
{
type: "view",
elements:
[
{
type: "view",
char_height: 10,
elements:
[
{
type: "static_text",
item_id: "stat",
name: "Check only ONE box:",
width: 152,
height: 23,
char_width: 15,
alignment: "align_fill",
font: "dialog",
},
{
type: "check_box",
item_id: "Chk1",
name: "Approved",
},
{
type: "check_box",
item_id: "Chk2",
name: "Approved as Noted - Proceed",
},
{
type: "check_box",
item_id: "Chk3",
name: "Revise and Resubmit",
},
{
type: "check_box",
item_id: "Chk4",
name: "Not a required submittal - not Reviewed",
},
{
type: "check_box",
item_id: "Chk5",
name: "Rejected - Do Not Use",
}
]
},
{
type: "ok_cancel",
},
]
},
]
}
};

// Example Code
//DiaBox.bChk1 = false;
//DiaBox.bChk2 = false;
//DiaBox.bChk3 = false;
//DiaBox.bChk4 = false;
//DiaBox.bChk5 = false;
//DiaBox.stredt1 = "";
//DiaBox.stredt2 = "";

if(event.source.forReal && (event.source.stampName == "#bsiloE85pqFs4ntcdBQCMC"))
{
  if ("ok" == app.execDialog(DiaBox))
  {

    this.getField("cbx1").checkThisBox(0, DiaBox.bChk1);
    this.getField("cbx2").checkThisBox(0, DiaBox.bChk2);
    this.getField("cbx3").checkThisBox(0, DiaBox.bChk3);
    this.getField("cbx4").checkThisBox(0, DiaBox.bChk4);
    this.getField("cbx5").checkThisBox(0, DiaBox.bChk5);
  }
}

if ("ok" == app.execDialog(DiaBox))
  {
    var cMsg = DiaBox.byName;
    event.value = "Project # " + cMsg;
    event.source.source.info.exhibit = cMsg;
  }

它将JS框分开,这是我可以捕获图章数据的唯一方法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM