Adobe acrobat forms javascript object specification 用户手册

下载
页码 64
Acrobat Forms - JavaScript Object Specification
63
“official”. A blind signature (signed without any appearance) is often useful in this situation
and can be created via the pull right menu in the signatures pane.
After fill-in a user can also sign the document either by using the signing tool or filling in a
pre-authored signature field, thus ensuring that the form undergoes no further changes without
detection.
Working with Signature Fields
Signature fields allow the user to digitally sign a document. Once a signature is applied to the
document any subsequent changes to the document will cause the signature to indicate that the
“Document has been changed after signing”.
A signature field’s value is read-only. An unsigned signature has a null value. Once the field
has been signed its value is non-null.
When crafting a custom script for when the signature field is signed remember to allow for
resetting the form (i.e. the field’s value is set to null). For example, imagine a form where
upon signing a signature field that all fields whose names starts with “A” are locked and all
fields whose names start with “B” are locked. We might start with a script fragment, to be
executed at signature time, looking something like this:
/* This example is incorrect. */
var f = this.getField("A");
/* Lock all A fields. */
f.readOnly = true;
f = this.getField("B");
/* Unlock all B fields. */
f.readOnly = false;
This is a typical operation for many forms. This script is incorrect and when the form is reset
it will lock and unlock the wrong fields. Instead, it should check the value of the signing event
and react accordingly:
var bLock = (event.value != "");
var f = this.getField("A");
/* Lock A on sign, unlock on reset. */
f.readOnly = bLock;
f = this.getField("B");
/* Unlock B on sign, lock on reset. */
f.readOnly = !bLock;
There is a convenience routine available for your use called AFSignatureLock() in AForm.js
(see
that performs the programmatic equivalent of the simple
locking user interface in the signature properties dialog. This allows you to easily lock and
unlock all fields, a particular list of fields, or all fields but those specified. The example is re-
coded using this convenience routine below:
var bLock = (event.value != "");
AFSignatureLock(this, "THESE", "A", bLock);
4.0