Class: FieldManager

Core.Annotations.Forms. FieldManager


new FieldManager(annotationManager)

Represents a tree of PDF Forms fields. @see Core.Annotations.Forms.Field Allows adding, getting and visiting fields.
Parameters:
Name Type Description
annotationManager Core.AnnotationManager

Methods


addField(field [, update])

Adds the given field object to the field tree, either replacing or merging with any existing field. Note: if the field is merged, it is the equivalent of performing Core.Annotations.Forms.Field#set on the existing field, followed by setting all the field's widgets' fields to the original field
Parameters:
Name Type Argument Default Description
field Core.Annotations.Forms.Field The field to be added
update boolean <optional>
false Whether to update an existing field or add a new one
Returns:
The field that was inserted into the field tree (may not be the field originally provided)
Type
Core.Annotations.Forms.Field

areRequiredFieldsFilled()

Iterates over every field and checks if it's required and if it has a value
Returns:
Returns True if there is no required field or all fields are filled out, false otherwise
Type
boolean

calculate(field [, index])

Equivalent to the given field's value changing, if it was at position index in the calculation order
Parameters:
Name Type Argument Default Description
field Core.Annotations.Forms.Field <nullable>
The field to set as source for the calculation event. May be null
index number <optional>
0 The index at which to start running the calculation order

disableWidgetHighlighting()

Disables widget highlighting for widget annotations

enableWidgetHighlighting()

Enables widget highlighting for widget annotations

fieldChanged(field)

Listener for field value changes
Parameters:
Name Type Description
field Core.Annotations.Forms.Field The field whose value changed

getCalculationOrder()

Gets the calculation order
See:
Returns:
An array of field names
Type
Array.<string>

getField(name)

Gets a field whose full name matches the one that is given
Parameters:
Name Type Description
name string The full name of the field to search for
Returns:
The field, or null if no field matches
Type
Core.Annotations.Forms.Field | null

getFields()

Returns an array of all field objects in the document
Returns:
Type
Array.<Core.Annotations.Forms.Field>

getOrCreateField(name)

Gets a field if it exists, or creates it if it doesn't. This method also ensures that all required parent fields will exist upon completion
Parameters:
Name Type Description
name string The fully qualified field name to be found or created
Returns:
An existing or newly-created field matching the provided name
Type
Core.Annotations.Forms.Field

isWidgetHighlightingEnabled()

Checks if highlight feature is enabled for widget annotations
Returns:
Whether widget highlighting is enabled or not
Type
boolean

print()

Invokes the available print handler to print the document. Note: This method requires Embedded JavaScript to not have been disabled with Core.disableEmbeddedJavaScript

setAlertHandler(handler)

Updates the function to be used for handling alert messages for field validation
Parameters:
Name Type Description
handler Core.Annotations.Forms.FieldManager.AlertHandler The function that will handle alert messages

setCalculationOrder(order)

Set the calculation order. Use this if you need changes in one field to trigger calculation events on other fields. If the name of the field that is changed is before the name of another field, that other field is recalculated. If the name of the field that has changed is not in the array, all the fields named by the array are recalculated in order
Parameters:
Name Type Description
order Array.<string> An array of field names

setPrintHandler(handler)

Sets the function to be used to handle the print API called by embedded PDF JavaScript
Parameters:
Name Type Description
handler function The function that will handle print requests

updateFieldName(field, name)

Renames the field that is passed to the name provided
Parameters:
Name Type Description
field Core.Annotations.Forms.Field The field that should be renamed
name string The name of the field to be renamed. Cannot be blank
Returns:
The renamed field
Type
Core.Annotations.Forms.Field | Core.Annotations.WidgetAnnotation | null

Type Definitions


AlertHandler(message)

A function for handling alert messages from field validation
Parameters:
Name Type Description
message string The alert message to display
Returns:
Type
void