onRequestInit
The onRequestInit
callback is triggered after the action options have been converted into fetch options but before the request has been made.
Use cases
Manipulate the headers
Manipulate the body
Perform validation on the data
Arguments
Argument
Type
Description
options
object
The fetch options used to initialise the request.
triggerEl
HTMLElement
or null
The element that triggered the action. If the action was triggered programmatically via the API the triggerEl will be null
.
Example
This example demonstrates how to include a value from the Webflow CMS in a request.
The below example assumes the CMS value is bound to a text element within the trigger elements parent element.
Last updated