new Field(name [, options])
Represents a PDF Form field.
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | The field's full name | |||||||||||||||||||||||||||||||||||||||||||||||||
options |
Core.Annotations.Forms.Field |
<optional> |
The options with which to construct the field. If options is a Field, the constructor returns the existing object
Properties
|
- Mixes In:
Properties:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
type |
string | Returns the field's type. One of ('Tx', 'Btn', 'Ch' or 'Sig') | ||
children |
Array.<Core.Annotations.Forms.Field> |
<optional> |
[] | The field's children |
widgets |
Array.<Core.Annotations.WidgetAnnotation> |
<optional> |
[] | The field's child widgets |
actions |
Object.<string, Array.<Core.Actions.Action>> |
<optional> |
{} | Gets the field's actions |
defaultValue |
number | string |
<optional> |
null | The field's default value |
exportValue |
number | string |
<optional> |
null | The field's export value. Defaults to the field's value if not set |
flags |
Core.Annotations.WidgetFlags |
<optional> |
new Core.Annotations.WidgetFlags() | The field's flags object |
font |
Core.Annotations.Font |
<optional> |
new Core.Annotations.Font() | Returns the field's associated font object |
IsModified |
boolean |
<optional> |
false | Is field is modified? |
maxLen |
number |
<optional> |
-1 | The field's maximum length. -1 means infinite |
name |
string | The full name of the field | ||
options |
Array.<{value: string, displayValue: string}> |
<optional> |
[] | The field's options (or permanently null if the field type does not support options) |
quadding |
string |
<optional> |
'Left-justified' | Returns the field's quadding. (One of 'Left-justified', 'Right-justified', 'Centered') |
value |
number | string |
<optional> |
null | The field's value |
tooltipName |
string | The text to be displayed when hovering over the field |
Listens to Events:
Methods
-
commit(value [, widget])
-
Commits the new value to the field (triggers Validate action, and updates all widgets)
Parameters:
Name Type Argument Description valuestring | number <nullable>
The new value widgetCore.Annotations.WidgetAnnotation <optional>
Optionally a particular widget annotation associated with the field -
getFieldType()
-
Returns the field's type
Returns:
The field type as defined by the FormFieldTypes enum- Type
- string
-
getValue()
-
Gets the field's value
Returns:
The value of the field- Type
- string | number
-
hide()
-
Disable visibility of all child widgets
-
isTerminal()
-
Checks whether the current field is a terminal/leaf node (no children).
Returns:
Whether this field is terminal/leaf node- Type
- boolean
-
refreshAppearances()
-
Refresh the appearance of each widget in the current field
-
set(options)
-
Set all field properties from the given object
Parameters:
Name Type Description optionsCore.Annotations.Forms.Field The object to set properties from -
setType(type)
-
Sets the field's type. Tries to retain as much type-specific information as possible across type changes
Parameters:
Name Type Description type'Tx' | 'Ch' | 'Btn' | 'Sig' The new field type -
setValue(value [, widget])
-
Sets the field's value, following any type-specific constraints, and updating all widgets
Parameters:
Name Type Argument Description valuestring | number <nullable>
The value to set widgetCore.Annotations.WidgetAnnotation <optional>
Optionally a particular widget annotation associated with the field Fires:
-
show()
-
Enable visibility of all child widgets
Type Definitions
-
DispatcherActions
-
An object that maps trigger names to arrays of Actions
Type:
- Object.<string, Array.<Core.Actions.Action>>
-
DispatcherOptions
-
Options for creating a Dispatcher
Type:
- Object
- Mixes In:
Properties:
Name Type Description actionsCore.Actions.Dispatcher.DispatcherActions The initial actions xfdfActionsElementElement The XFDF element containing actions documentViewerCore.DocumentViewer The DocumentViewer instance
Events
-
calculate
-
A signal that the field should fire its own calculation events
Parameters:
Name Type Description sourceCore.Annotations.Forms.Field The field that caused the calculation event Listeners of This Event:
-
change
-
An event that represents a field's value having changed
Parameters:
Name Type Description fieldCore.Annotations.Forms.Field The field that has changed -
commit
-
The field's value has been changed by the user. Sets a new value
Parameters:
Name Type Argument Description valuestring | number <nullable>
The new field value Listeners of This Event: