The form element is always the top element of the JSON structure.
The following properties may be used on form object:
Property | Description | Example |
---|---|---|
text | The title of the form. It is displayed in the form’s top title bar. If not specified then the form will display the calling menu item’s name as title. | “text”: “Sales orders” |
params | The list of the form’s input parameters. An array with parameter names. | “params”: [“order”, “customer”] |
onLoad | An action that should be run when onLoad event occurs (triggered when the form has just been loaded). | “onLoad”: action |
metadata | The name of the default metadata (object/object.method). It will serve as a source for form fields creation. | “metadata”: “salesOrders.get” |
elements | The list of child elements - form fields that will constitue the form content. | “elements”: [field1, field2] |
events | An array of event elements. The form will listen for the events listed here and run specified action when such event occurs. | “events”: [event1, event2] |
actions | An array of action elements. This is the set of the form’s main actions, by default rendered as buttons. | “actions”: [action1, action2] |
Example of a form with the title, 2 fields and 2 actions…
{
"text": "My form",
"elements": [
{ "id": "field1", "text": "Text field", "length": 10 },
{ "id": "field2", "text": "Numeric field", "length": 10, "type": "number" }
],
"actions": [
"*close",
{
"text": "My action",
"form": "myform2"
}
]
}
… and the generated HTML form