Toggle menu

Commands

The getCommands method returns commands for the caller to process based upon the current form state in the order they should be processed. 

­RENDER

Render commands contain form related content that should be output in the <header> and <body> sections of the page. The caller does not need to know anything about what it is rendering - it simply receives a RENDER command and outputs it in the order received to the page. As with all commands other than FINISH, there may be multiple such commands.

After a successful, valid render and submission of a multipage form another RENDER command will be received, this time containing header and body content for PAGE n of the form. In the case of a validation failure the RENDER command will contain a form populated with the previous submitted form data, and suitable validation errors.

RENDER commands can also be generated by handlers, for example the CONFIRMATIONMSG field generates the second command below, outputting <p>Thank You</p> to the page.

Properties

NameDescription
headerContentShould be output in the page header
bodyContentShould be output in the body of the page. 
This may be the actual HTML content, eg the <form/> tag and everything inside it
mainFormContentTrue if this RENDER command contains main form content (ie the actual <form>),  and false if not (eg confirmation action text)
currentPageTitleThe current page title (page title is set in the forms designer)

Example JSON

Form:

{
    "commandName": "RENDER",
    "params": {
        "currentPageTitle": "",
        "identifier": null,
        "mainFormContent": true,
        "headerContent": "<FORM_HEADER_CONTENT>",
        "bodyContent": "<FORM_HTML>"
    }
}

Generated by the CONFIRMATIONMSG field type:

{
    "commandName": "RENDER",
    "params": {
        "mainFormContent": false,
        "headerContent": "",
        "bodyContent": "<p>Thank You</p>"
    }
}

EXECUTE_ACTION

Actions unable to be handled by the Forms Service (ie actions that do not have a registered handler) are returned in the form of an EXECUTE_ACTION command for support of legacy actions. This command contains the field name, action type, and any properties associated with it for the caller to handle.

Properties

NameDescription
fieldNameName of the action field on the form.
typeThe action type.
propertiesAny properties associated with the action as a name/value map. May be specified as properties of the field type, or created programmatically.
rawPropertiesAny properties associated with the action, returned as the raw structure as it is stored in user context variables. May be specified as properties of the field type, or created programmatically.

Example JSON

The command resulted from renaming a CONFIRMATIONMSG field type to DISPLAYTHISMESSAGE, placing one on the form, and submitting it.

{
    "commandName": "EXECUTE_ACTION",
    "params": {
        "type": "DISPLAYTHISMESSAGE",
        "fieldName": "DISPLAYTHISMESSAGE",
        "properties": {
            "MESSAGE": "Thank You",
            "CLASS": "[...]ConfirmationAction"
        },
        "rawProperties": {
            "ACTION_DISPLAYTHISMESSAGE:MESSAGE": "Thank You",
            "ACTION_DISPLAYTHISMESSAGE": "MESSAGE,CLASS",
            "ACTION_DISPLAYTHISMESSAGE:CLASS": "[...]ConfirmationAction",
            "ACTIONS": "DISPLAYTHISMESSAGE:DISPLAYTHISMESSAGE"
        }
    }
}

ERROR

Errors that occur during the processing of a form submission (via a POST to /processformsubmission or via the /redirect method) are returned as an ERROR command as they cannot be returned to the caller any other way. The error messages contain technical information about the failure and are not intended to be presented to the user, but logged and handled as the caller sees fit.

Properties

NameDescription
errorMessageThe error message, likely resulting from a Java exception
stackTraceThe stack trace, likely resulting from a Java exception

Example JSON

{
    "commandName": "ERROR",
    "params": {
        "errorMessage": "The fibble failed to wibble.",
        "stackTrace": "[stack trace]"
    }
}

FINISH

Indicates that all processing is complete, ie we've reached the end of the form and all actions have been successfully executed. The form session is deleted just before this command is returned to the caller, and can no longer be used.

Example JSON

{
    "commandName": "FINISH",
    "params": {}
}

Last modified on September 11, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon