OpenWGA 7.7 - TMLScript reference


Object:

FormInfo

Description FormInfo is an object holding information to create a TMLForm object from TMLScript.

A FormInfo object contains all settings that normally are done on a <tml:form> tag when defining a WebTML form from WebTML. Use this object on method WGA.createForm() to actually build a WebTML form from the settings.

It is possible to first build a WebTML form from TMLScript using this object, initialize it somehow directly in TMLScript and then display it using a <tml:form> tag offering it to the user for editing. You just need to specify the same ID on the form tag that you used to create the FormInfo object.
Retrieval

tmlform.formInfo of existing forms

WGA.createFormInfo() or Design.createFormInfo() to create a new FormInfo object

Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
    portletevent
Properties and methods
Name Purpose
contentClass Hosts the content class of documents created and edited with this form.
formId Holds the ID of the WebTML form
htmlinput Controls if the created form will accept plain HTML input fields
mode Hosts the display mode of the WebTML form
persistent Controls if the created form is to be stored persistently on the user session
source Controls the data source of the WebTML form to create
targetContextPath Determines the target context on which this WebTML form operates
trim Controls if the created form is to automatically trim field contents
Examples An example how to create a TMLForm object from TMLScript. First a FormInfo object is created and configured. After that the TMLForm object is created on base of the FormInfo object. Some field initialisation might be directly done after that in TMLScript:

var formInfo = WGA.createFormInfo("formid", false, true);
formInfo.source = "none";
formInfo.trim = true;
var form = WGA.createForm(formInfo);
form.setField("name", "(Please enter your name)");


After that the created form can be picked up by a <tml:form> tag by just using the same ID again. Note however that for regular (non-persistent) forms this must be done in the same request as the TMLForm creation as forms normally do not persist accross multiple requests if they are not submitted:

<tml:form id="formid">
Name: <tml:input name="name"/>
</tml:form>