Default Payload
Last updated on June 26, 2024.
The option in Forms lets you specify default request parameters in JSON format. Before validation, the specified data and request parameters are combined. All attributes must be declared in the form to be passed in this manner.
Why and where to use 'default_payload'
The option can be employed in any form requiring the inclusion of data not directly entered by a user during form submission. The request data is processed using Liquid and combined with the request data to create a new or original attribute. A useful example is a slug property formatted based on the title or name property.
Another key attribute of is its ability to enable the server-side modification or extension of user input. This feature can be utilised, for instance, to save references or compute prices, as users cannot alter its value maliciously, even if they attempt to edit a form's HTML.
Form variable
Liquid Template provides a variable populated with various properties useful when dealing with forms.
Example
Default Payload can help set action timestamps, states, or modification of request state. In the example below, the custom property is set with each form submission:
Record example
Here is another example demonstrating the use of default payloads: