Scripting support for HTML5 forms
- Topics:
- Mobile Forms
CREATED FOR:
- User
JavaScript, FormCalc properties, and methods supported in HTML5 forms are as listed below:
$event
Property | Description | Exception |
---|---|---|
prevText | Specifies the content of the field before it changes in response to the actions of a user. This value can be recalled, similar to an undo feature. |
Does not work for drop-downs and list boxes.
Setting value through script is not supported. |
target | Specifies the object upon which the event is acting. | Setting value through script is not supported. |
newtext | Specifies the content of the field after it changes in response to user actions. |
The
Setting value through script is not supported. |
change | Specifies the value that a user types or pastes into a field immediately after they perform the action. |
The change property does not work properly for following cases:
Setting value through script is not supported. |
keydown | Determines whether a user is pressing an arrow key to make a selection. This property is available only for list boxes and drop-down lists. | None |
modifier | Determines whether the modifier key (for example, Ctrl on Microsoft® Windows®) is held down when a particular event executes. | None |
$host
Property | Description | Exception |
---|---|---|
apptype | Returns the application type of the host. Available only for client applications. | Returns HTML 5 . |
name | Returns the name of the current application. | Returns the browser name and its version. For example, in Chrome browser, the value returned is Chrome <version>. |
numPages | Returns the number of pages in the document. | Pagination policy of HTML5 forms is not identical to PDF forms pagination policy. So the numPages API can return a different values in both the cases. |
platform | Returns a string representing the platform of the computer running the script. | None |
title | Specifies the title of the document. It is available only for client applications. | It returns title of HTML document in form, rather than the form metadata title as in the case of PDF Forms. |
version | Returns a string representing the version number of the current application. | It returns the version of the form. |
calculationsEnabled | Specifies whether calculate scripts will execute. | None |
validationsEnabled | Specifies whether validation scripts will execute. | None |
pageUp | Goes to the previous page. | HTML5 forms do not follow the same pagination policy as PDF Form, so the previous page of an HTML5 form is different from previous page of a PDF Form. |
pageDown | Moves to the next page of a form. Use the pageDown method at runtime. | |
setFocus | Sets the keyboard focus to the field specified. The field is specified as an object, or by the SOM expression of the field. It is available only for client applications. | |
resetdata | Resets the fields to their default values within a document. | Clears all data in a form with merged data, rather than restoring it to default values. |
messageBox | Displays a dialog box on the screen. It is available only for client applications | Message box of type Yes/No is converted to OK/Cancel. Message box with three buttons is not supported. |
currentPage |
Sets the currently active page of a document at runtime. Page values are 0-based, so the first page of a document returns a value of 0. The currentPage property is available when layout:ready executes on a client. However, it is not available when layout:ready executes on the server because the property will not execute until the form layout executes. | None |
field
Property | Description | Exception |
---|---|---|
presence | Controls the participation of the associated object in different phases of processing. If the object is a container, the contents of the container inherit whatever restrictions this control applies. | None |
access | Controls user access to the contents. | Does not work for the exclusion group. Moreover, HTML5 forms gives same treatment to non-interactive and protected objects. |
name | An identifier that is used to identify this element in script expressions. | HTML5 forms do not allow setting name property for objects. It is read-only property for HTML5 forms. |
value | A content element that encloses a single unit of data content. | None |
rawValue | Specifies the unformatted value for this field. | None |
formattedValue | Specifies the formatted value for this field. | Setting formattedValue through script is not supported. |
editValue | Specifies the edit value for this field. | Setting editValue through script is not supported. |
formatMessage | Specifies the format validation message string for this field. | Setting formatMessage through script is not supported. |
fillcolor | Specifies the background color value for this field. You need to set the border.fill.presence property to visible separately. | It does not correctly return default color of the field. |
border | The border object describes the border surrounding an object. | |
ui | The ui object encloses the user interface description of a form object. | |
mandatory | Specifies the nullTest value for the field. | |
borderColor | Specifies the border color value for this field. You need to set the border.edge.presence property to visible separately. | It does not correctly return default border color of the field. |
length | The number of items in the list. | None |
addItem | Adds new items to the current field. | None |
clearItem | Removes all the items from the field. | None |
boundItem | Gets the bound value of a specific display item of a drop-down list or list box. | None |
execCalculate | Executes the calculate script of the field. | None |
execValidate | Executes the validate script of the field. | None |
execEvent | Executes the event script of the object. | None |
getItemState | Returns the selection state of the specified item | None |
setItemState | Sets the selection state of the specified item. | None |
getDisplayItem | Retrieves the item display text for the specified item index. | None |
getSaveItem | Retrieves the data value for the specified item index. | None |
deleteItem | Deletes the item at the specified index. | None |
setItems | Sets the specified items in the current field. It replaces pre-existing items. | None |
h | A measurement of the height for the layout. | None |
w | A measurement specifying the width for the layout. | None |
x | Specifies the x coordinate of the container’s anchor point relative to the upper-left corner of the parent container when placed with positioned layout. | None |
y | Specifies the y coordinate of a container’s anchor point relative to the upper-left corner of the parent container when placed with positioned layout. | None |
caption | The caption object describes a descriptive label associated with a form design object. | None |
validate | The validate object controls validation of user-supplied data on a form. The validate object can be activated multiple times during the life of a form. | None |
parentSubform | Specifies the parent subform (page) of this field. | Always returns parent subform instead of returning first non-scoping parent subform. |
selectedIndex | The index of the first selected item. | None |
Form
Property | Description | Exception |
---|---|---|
formNodes | Returns a list of all form model objects that are bound to a specified data object. |
InstanceManager
Property | Description |
---|---|
name | An identifier that is used to identify this element in script expressions. |
occur | Describes the constraints over the number of allowable instances for its enclosing container. |
min | Specifies the minimum number of instances that can be instantiated. |
max | Specifies the maximum number of instances that can be instantiated. |
count | Specifies the current number of instances instantiated. |
setInstances | Adds or removes the specified subforms or subform sets from this node. |
addInstance | Adds a new instance of a subform or subform set to this node. |
removeInstance | Removes a subform or subform set from this node. |
moveInstance | Moves a child object of a form model object to another specified location within the form model. The corresponding data model information for the object is also relocated within the data model. |
insertInstance | Inserts a new instance of a subform or subform set to this node. |
list
Property | Description |
---|---|
length | The number of elements in the list. |
item | A zero-based index into the collection. |
append | Appends a node to the end of the node list. |
remove | Removes a node from the node list. |
insert | Inserts a node before a specific node in the node list. |
node
Property | Description | Exception |
---|---|---|
createNode | Creates new node based on a valid class name. | None |
isContainer | Specifies whether this object is a container object. | None |
isNull | Indicates whether the current data value is a null value. | None |
resolveNode | Evaluates the specified SOM expression, beginning with the current XML form object model object, and returns the value of the object specified in the SOM expression. | None |
resolveNodes | Evaluates the specified SOM expression, beginning with the current XML form object model object, and returns the value of the object specified in the SOM expression. | None |
oneOfChild | Creates new node based on a valid class name. | None |
getElement | Returns a specified child object. | None |
getAttribute | Gets a specified property value. | None |
setAttribute | Sets the value of a specified property. | None |
model
Property | Description | Exception |
---|---|---|
NA | NA | NA |
Subform
Property | Description | Exception |
---|---|---|
instanceIndex | Specifies the index of the object, relative to the other instantiated instances. | None |
execEvent | Executes the event script of the object. | None |
getInvalidObjects | Returns a list of nodes contained within the subform (inclusive), that have failed the validation test. | None |
border | The border object describes the border surrounding an object. | None |
borderColor | Specifies the border color value for this field. You need to set the border.edge.presence property to visible separately. | None |
h | A measurement of the height for the layout. | None |
w | A measurement specifying the width for the layout. | None |
x | Specifies the x coordinate of the container’s anchor point relative to the upper-left corner of the parent container when placed with positioned layout. | None |
y | Specifies the y coordinate of a container’s anchor point relative to the upper-left corner of the parent container when placed with positioned layout. | None |
validate | The validate object controls validation of user-supplied data on a form. The validate object can be activated multiple times during the life of a form. | None |
name | An identifier that is used to identify this element in script expressions. | None |
presence | Specifies an object’s visibility. | None |
access | Controls user access to the contents of a container object, such as a subform. | None |
execValidate | Calculates the index of a subform or subform set based on where it is located relative to other instances of the same form object. | None |
instanceManager | The instanceManager object manages the instance creation, removal, and movement of form model objects. | None |
submit
Property | Description |
---|---|
target | The URL to which the data is submitted. Omission of this attribute implies the XFA processing application obtains the URI using a product-specific technique, such as accessing product-specific information in the config object. |
tree
Property | Description | Exception |
---|---|---|
nodes | Returns a list of all child objects of the current object. |
|
name | Specifies the name of this node. | Setting the name using scripts is not allowed in HTML. |
parent | Gets the parent for this node. | None |
index | Returns the position of this node in its collection of like-named, in-scope, like-child relationship nodes. | None |
somExpression | Gets the SOM expression for this node. | None |
resolveNode | Evaluates the specified SOM expression, beginning with the current XML form object model object, and returns the value of the object specified in the SOM expression. | None |
resolveNodes | Evaluates the specified SOM expression, beginning with the current XML form object model object, and returns the value of the object specified in the SOM expression. | None |
subformset
Property | Description | Exception |
---|---|---|
instanceManager | The instanceManager object manages the instance creation, removal, and movement of form model objects. | None |
content
Property | Description | Exception |
---|---|---|
isNull | Indicates whether the current data value is the null value. |
dataValue
Property | Description | Exception |
---|---|---|
isNull | Indicates whether the current data value is the null value. |
edge
Property | Description | Exception |
color | The color property describes a unique color for the pattern object. |
|
fill
- The default value cannot be retrieved.
- The changes are reflected in Model and are available for scripting but are not synced to HTML elements. Hence, the changes are not reflected in the UI.
linear
- The default value cannot be retrieved.
- The changes are reflected in Model and are available for scripting but are not synced to HTML elements. Hence, the changes are not reflected in the UI.
line
pattern
- The default value cannot be retrieved.
- The changes are reflected in Model and are available for scripting but are not synced to HTML elements. Hence, the changes are not reflected in the UI.
radial
- The default value cannot be retrieved.
- The changes are reflected in Model and are available for scripting but are not synced to HTML elements. Hence, the changes are not reflected in the UI.
stipple
- The default value cannot be retrieved.
- The changes are reflected in model and are available for scripting but are not synced to HTML elements. Hence, the changes are not reflected in the UI.
draw
corner
- The default value cannot be retrieved.
- The changes are reflected in model and are available for scripting but are not synced to HTML elements. Hence, the changes are not reflected in the UI.
checkButton
choiceList
dateTimeEdit
Image
imageEdit
numericEdit
object
rectangle
textEdit
exclGroup
arc
border
$layout
- Height (h) property is not supported for page area and content area.
- Parameter 'Offset from first content area the XFA-Form object occurs on' is not supported.
- Width (w) property is not supported for page area and content area.
- Parameter 'Offset from first content area the XFA-Form object occurs on' is not supported.
- x coordinate (x) property is not supported for page area and content area.
- Parameter 'Offset from first content area the XFA-Form object occurs on' is not supported.
- y coordinate (y) property is not supported for page area and content area.
- Parameter 'Offset from first content area the XFA-Form object occurs on' is not supported.
- layout.pageCount() method returns different values for PDF and HTML forms.
- On decreasing page count by hiding an object, abspagecount method returns incorrect value.
- layout.pageCount() method returns different values for PDF and HTML forms.
- On decreasing page count by hiding an object, abspagecount method returns incorrect value.
items
FormCalc
FormCalc is an XFA-specific language for creating e-form centric logic and calculations roots. FormCalculation provides a powerful set of build functions.
FormCalc Supported Functions
FormCalc Expression Support
var a=3
a=3
- Logic (and/or)
- Comparison (greater/less/ equal)
1 <> 2
A NE B
A or 1
1 <> 2
A NE B
do s = s + i endfor
do s = s + i endfor
Acrobat API Support
-
Arithmetic Functions
- Abs()
- Avg()
- Ceil()
- Count()
- Floor()
- Max()
- Min()
- Mod()
- Round()
- Sum()
-
Scientific Functions
- Acos()
- Asin()
- Atan()
- Atan2()
- Cos()
- Sin()
- Tan()
- Exp()
- Log()
- Pow()
- Sqrt()
- Deg2Rad()
- Rad2Deg()
- Pi()
-
Financial Functions
- Apr()
- Cterm()
- Fv()
- Ipmt()
- Npv()
- Pmt()
- Ppmt()
- Pv()
- Rate()
- Term()
-
Logical Functions
- Choose()
- If()
- Oneof()
- Within()
-
String Functions
- At()
- Concat()
- Left()
- Len()
- Lower()
- Ltrim()
- Replace()
- Right()
- Rtrim()
- Space()
- Stuff()
- Substr()
- Upper()
- WordNum()
-
Date and Time
- Date()
- num2date()
- DateFmt()
Supported XFA events
The following client sided XFA events are supported:
- Initialize
- Validate
- Calculate
- Click
- Enter
- Exit
- Change
- ValidationState