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 | 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.<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.<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. |
tooltipName |
string | The text to be displayed when hovering over the field. |
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
Core.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 form the given object.
Parameters:
Name Type Description options
Core.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
Core.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? - Deprecated:
-
- since version 8.0 Please use show or hide instead
-
show()
-
Enable visibility of all child widgets
Events
-
calculate
-
A signal that the field should fire its own calculation events.
Parameters:
Name Type Description source
Core.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
Core.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: