DropForm with Vue
Integrate DropForm into a Vue app using fetch. Includes Options API example, loading state, inline errors, and file uploads.
This guide shows how to submit forms to DropForm from Vue using the Submission API endpoint: POST https://api.dropform.app/s/{uid}.
We’ll build a Vue component using the Options API with:
- reactive state
- loading indicator
- inline success/error feedback
- file uploads via FormData
What you need
- Your form endpoint:
https://api.dropform.app/s/{uid} - A Vue app (Vue 3 recommended)
Vue example (Options API + FormData)
The recommended approach is fetch + FormData. It works for normal fields and file uploads, and it keeps the payload format consistent across browsers.
Single File Component example
JSON mode (optional)
If you don’t upload files and you prefer JSON requests, you can submit application/json. This is useful if you’re not using an HTML form element.
Example: submit JSON
File uploads
File uploads work automatically when you use FormData. If you want to guarantee JSON response mode for multipart uploads, include a data part with Content-Type: application/json.
Example: force multipart JSON mode (optional)
Common gotchas
- Don’t set Content-Type for FormData: the browser sets the multipart boundary for you.
- Use redirects for simplest static sites: if you don’t need AJAX, HTML form action is easier.
- Handle 400 errors: DropForm returns JSON with validation failure details (message).
