SubmitForm
Parameters
- url
(string)
- The URL to which the form data should be submitted. - options
(Omit<SubmitFormAction, 'type' | 'url'>)
- Options that configure the form submission action. These can include form parameters, success/error handlers, and other settings (optional parameter).
Return Value
Returns an object of type SubmitFormAction
, which represents the form submission action and can be processed by other functions to perform an HTTP request and handle the response.
Properties of the SubmitFormAction Object
- type
(submitForm)
- Indicates the action type as "submitForm". - url
(string)
- The URL for submitting the form data. - formId
(string)
- The identifier of the form to retrieve all its elements (optional). - params
(Record<string, unknown>)
- Additional parameters sent along with the request (optional). - confirm
(string)
- A message for confirmation before submitting the form (optional). - event
(SubmitEvent)
- The form submission event (optional). - onSuccess
((data: Record<string, unknown>) => Promise<void | boolean>)
- A handler for successful submission. Executed after a successful response from the server (optional). - onError
((data: Record<string, unknown>) => Promise<void>)
- A handler for submission errors. Executed if the server returns an error (optional).