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.

com.tibco.forms.client.Form Class - Field Details
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.
com.tibco.forms.client.Form Class - Method Details
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.
Note: This method is not supported when an iframe is used to load the form using the built-in iframe integration support.
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 the TIBCO 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.
Note: This method is not supported when an iframe is used to load the form using the built-in iframe integration support.
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.
Note: This method is not supported when an iframe is used to load the form using the built-in iframe integration support.
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:
  • actionName - Used to specify the name of the
  • action (For example, ACTION_CLOSE). If the action is ACTION_SUBMIT, then all the validations in the form will be invoked prior to invoking the callback handlers. If any of the validations fail, then the callback handler will not be invoked.
  • handler - This is the function that is invoked for the specified actionName. The form may have only one handler for each action. If this method is called more than once for the same actionName, the handler set previously will be replaced. Passing in null for this parameter will remove the handler for this particular action. The method signature of the handler function has two arguments: a string for the actionName and the form object.
setLocale(String
locale)
Void Sets the string representation of the locale currently being used to render the form. For example, "en" or "en_US".