new Field(name [, options])
Represents a PDF Form field.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | The field's full name. | |||||||||||||||||||||||||||||||||||||||||
options |
Annotations.Forms.Field | object |
<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.<Annotations.Forms.Field> |
<optional> |
[] | The field's children |
widgets |
Array.<Annotations.WidgetAnnotation> |
<optional> |
[] | The field's child widgets |
actions |
object.<string, Array.<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 |
Annotations.WidgetFlags |
<optional> |
new Annotations.WidgetFlags() | The field's flags object |
font |
Annotations.Font |
<optional> |
new 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.<object> |
<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. |
userName |
string | The text to be displayed when hovering over the field. | ||
tooltipName |
string | The text to be displayed when hovering over the field and the userName property is not defined. |
Listens to Events:
Methods
-
commit(event, value [, widget])
-
Commits the new value to the field (triggers Validate action, and updates all widgets)
Parameters:
Name Type Argument Description event
* Ignored. value
string | number <nullable>
The new value. widget
Annotations.WidgetAnnotation <optional>
Optionally a particular widget annotation associated with the field -
getValue()
-
Gets the field's value
Returns:
The value of the field- Type
- string | number
-
isTerminal()
-
Checks whether the current field is a terminal/leaf node (no children).
Returns:
Whether this field is terminal/leaf node- Type
- boolean
-
set(options)
-
Set all field properties form the given object.
Parameters:
Name Type Description options
Annotations.Forms.Field | object 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
string The new field type, one of Tx, Ch, Btn or Sig. -
setValue(value [, widget])
-
Sets the field's value, following any type-specific constraints, and updating all widgets.
Parameters:
Name Type Argument Description value
string | number <nullable>
The value to set. widget
Annotations.WidgetAnnotation <optional>
Optionally a particular widget annotation associated with the field Fires:
-
setVisible(visible)
-
Sets the visibility of all child widgets
Parameters:
Name Type Description visible
boolean Should the field be visible?
Events
-
calculate
-
A signal that the field should fire its own calculation events.
Parameters:
Name Type Description source
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 field
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 value
string | number <nullable>
The new field value. Listeners of This Event: