Form Function
A form function is triggered either upon the form's submission or on adding or updating input in a form field. When a user adds or updates an input value in a form field or clicks the submit or cancel button in the form, the form function associated with this function is triggered to execute the intended action. There are the handlers associated with the form function:
- Form Submit Handler
- Form Change Handler
- Dynamic Field Handler
- Form View Handler
Form Submit Handler
The submit handler is triggered on the form's submission. If the form's on change handler is configured, the submit handler is triggered once the on change handler is executed successfully.
Form Change Handler
The change handler is triggered for an update made in any form field containing the boolean trigger_on_change as true. The change handler can be used to either add or remove fields in the form depending on the input made for a certain field.
Dynamic Field Handler
The filed change handler is triggered for input field of type, dynamic_select. The handler auto-populates the drop-down menu items for the field based on the users' search query.
Form View Handler
The form view handler is used to generate a form permalink or a QR code, which can be used to access the form independently without the use of commands, message actions or any other internal tool.
A list of attributes are passed when a function is triggered. They are listed in the table below
Attribute Name | Data Type | Description |
user | map | Details of the user who has triggered the function. |
chat | map | Chat details in which the function is triggered. |
form | map | Details of the form object and the input values. |
message | map | Details of the message for which the form is invoked along with ack_key, time, text, id, type, triggered_by and content. |
Form Object Syntax
{
"values": {},
"name": "",
"action": "" submit/cancel
}