com.tibco.forms.client.Form
The com.tibco.forms.client.Form class provides access to the runtime form object. This object enables you to access panes and controls within the form, register handlers for form actions, and access data to be submitted back to the server.
The com.tibco.forms.client.Form class has six fields that are used for setting action handlers. It also implements the methods listed in the table below.
Field | Data Type | Description |
---|---|---|
ACTION_APPLY |
String | Identifies the "apply" action. |
ACTION_CANCEL |
String | Identifies the "cancel" action. |
ACTION_CLOSE |
String | Identifies the "close" action. |
ACTION_RESET |
String | Identifies the "reset" action. |
ACTION_SUBMIT |
String | Identifies the "submit" action. |
ACTION_VALIDATE |
String | Identifies the "validate" action. |
Method | Return
Value |
Description |
---|---|---|
destroy() |
Void | Removes the form from its container and also releases its resources. This can be called by the client application to close the form. |
getFactory() |
Object | Returns the factory object for the given form. This provides access to the BOM JavaScript factories associated with the BOM types used by this form, as documented under the factory variable available within form action and validation scripts. |
getLoadStats() |
LoadStat | Returns an array of LoadStat objects. Each statistic represents the measurement of a particular phase of the form load. This can be used by applications to report this information in the user interface or otherwise log the information.
To enable collecting load statistics at runtime, the URL used by the client application to load the form should contain the parameter tibco_instr with a value true. Otherwise getLoadStats() method would return an empty array. This method takes an optional callback function as an argument to support iframe integration, where the method returns asynchronously: getLoadStats(Function callback) The callback function is optional for non-iframe mode, but required for iframe mode. The method still returns the value in non-iframe mode for backward compatibility. However, use of the callback function is recommended for both iframe and non-iframe modes. For example: form.getLoadStats(function(loadStats){ for (idx in loadStats) alert(loadStats[idx].label + ": " + (loadStats[idx].endTime - loadStats[idx].startTime) + " ms"; }); To use the getLoadStats() method, the client application needs to subscribe to PageBus event 'com.tibco.forms.form.loaded'. See com.tibco.forms.client.LoadStat for more details. |
getLocale() |
String | Returns the string representation of the locale being used to render the form.
This method takes an optional callback function as an argument to support iframe integration, where the method returns asynchronously: getLocale(Function callback) The callback function is optional for non-iframe mode, but required for iframe mode. The method still returns the value in non-iframe mode for backward compatibility. However, use of the callback function is recommended for both iframe and non-iframe modes. For example: form.getLocale(function(locale) { alert("Form Locale is: " + locale); }); |
getPackage() |
Object | Returns the object that provides access to the BOM JavaScript package definitions associated with the BOM types used by this form, as documented under the pkg variable available within form action and validation scripts. |
getResource() |
Object | Returns the object that provides access to the resource bundles associated with this form, as documented under the resource variable available within form action and validation scripts. |
getSerializedParameters () |
String | Returns a JSON representation of the data being managed by the form. This is typically called from a submit handler in order to send the final results back to the server.
This method takes an optional callback function as an argument to support iframe integration, where the method returns asynchronously: getSerializedParameters(Function callback) The callback function is optional for non-iframe mode, but required for iframe mode. The method still returns the value in non-iframe mode for backward compatibility. However, use of the callback function is recommended for both iframe and non-iframe modes. For example: form.getSerializedParameters(function(data) { alert('form data: ' + data); }); |
setActionHandler( String actionName, Function handler) |
Void | Adds a handler to the form that is invoked when the specified action is invoked in the form. Note that any handler already registered for this action will be replaced by this handler. The parameter details are as follows:
|
setLocale(String locale) |
Void | Sets the string representation of the locale currently being used to render the form. For example, "en" or "en_US". |