Skip to main content

CotomyApiForm

Form that submits to an API endpoint and surfaces failure events.

Properties

PropertyTypeDescription
actionUrlstringForm action URL (required).

Methods

MethodDescription
apiClient()Returns a new CotomyApi instance.
apiFailed(handle)Subscribes to cotomy:apifailed.
submitFailed(handle)Subscribes to cotomy:submitfailed.
formData()Builds a FormData from form fields.
submitAsync()Builds FormData and submits to the API.

Protected Methods (for subclassing)

MethodDescription
triggerApiFailedEvent(response)Dispatches the API failed event.
triggerSubmitFailedEvent(response)Dispatches the submit failed event.
submitToApiAsync(formData)Submits FormData and returns the response.