[英]Programmatic validation + submit in an Acrobat PDF form
Upon pressing the "submit" button of my PDF form, I'd like to do something (set a field to readonly) conditionally on the success of the form validation and submission processes: 按下我的PDF表单的“提交”按钮后,我想有条件地对表单验证和提交过程的成功做一些事情(将字段设置为只读):
if (form.isValid()) {
submitForm(...);
if (form.wasSubmittedSuccessfully()) {
//doSomething();
}
}
I'd like to know if there's an easy way to implement form.isValid()
(ie verify that all required fields are non-null and correctly formatted) and form.wasSubmittedSuccessfully()
above. 我想知道是否有一种简单的方法来实现
form.isValid()
(即验证所有必需字段是非空的并且格式正确)和form.wasSubmittedSuccessfully()
以上。
It seems like you need to embed some Javascript (validation function) in your PDFs and attach the function to click event of a submit button. 您似乎需要在PDF中嵌入一些Javascript(验证功能)并附加功能以单击提交按钮的事件。
JavaScript™ for Acrobat® API Reference contains information about anything in Javascript supported by Adobe products. JavaScript™forAcrobat®APIReference包含有关Adobe产品支持的Javascript中的任何信息。 Some of the methods and properties are also supported by 3rd-part y viewers.
第三部分y观众也支持一些方法和属性。
You can embed Javascript in a PDF using Acrobat Professional and a number of 3rd-party tools and libraries. 您可以使用Acrobat Professional和许多第三方工具和库将Javascript嵌入到PDF中。
EDIT: 编辑:
Here are couple of links that might help you to get started: 以下是一些可能有助于您入门的链接:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.