如何验证PDF表单? [英] How to validate PDF form?
问题描述
我有一个用 Acrobat Professional 制作的可写 PDF 表单.我想验证一个数字条目是否在某个范围内 [a,b].如果不是,我希望弹出一个带有消息的警报,请通过 XXX-XXX-XXXX 联系 Larry 以处理您的表格."有人可以编写一个快速的代码片段来为 PDF 执行此操作吗?我知道如何为网络表单执行此操作.
I have a writeable PDF form made in Acrobat Professional. I want to validate that a numerical entry is in a certain range [a,b]. If it is not, I want an alert to pop up with the message, "Please contact Larry at XXX-XXX-XXXX to get your form processed." Can someone write up a quick snippet of code that does this for a PDF? I know how to do it for a web form.
推荐答案
你可以这样做:
if (event.value > 3 && event.value < 10) {
event.rc = false;
app.alert({
cMsg: "Please contact Larry at xxx to process your form.",
cTitle: "My Window Title",
nIcon: 0,
nType: 1
});
}
您可以通过编辑字段的属性来输入此验证脚本.转到验证选项卡",单击运行自定义验证脚本",然后单击编辑...".在 JavaScript 编辑器窗口中输入代码,然后单击确定"和关闭".
You can enter this validation script by editing the properties of a field. Go to "Validate Tab", click "Run custom validation script", then "Edit...". Type the code into the JavaScript Editor window, and then click "Ok" and "Close".
(来源:skitch.com)
这篇关于如何验证PDF表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!