|
@@ -5,7 +5,7 @@ title: "Form"
|
|
|
permalink: docs/form/
|
|
|
---
|
|
|
|
|
|
-Form plugin collects metadata from any specified `<form>` element, right before Uppy begins uploading/processing files. And then optionally appends results back to the form. Currently the appended result is a stringified version of a [`result`](docs/uppy/#uppy-upload) returned from `uppy.upload()` or `complete` event.
|
|
|
+The Form plugin collects metadata from any specified `<form>` element, right before Uppy begins uploading/processing files, and then optionally appends results back to the form. Currently, the appended result is a stringified version of a [`result`](docs/uppy/#uppy-upload) returned from `uppy.upload()` or `complete` event.
|
|
|
|
|
|
```js
|
|
|
const Form = require('@uppy/form')
|
|
@@ -19,12 +19,16 @@ uppy.use(Form, {
|
|
|
|
|
|
This plugin is published as the `@uppy/form` package.
|
|
|
|
|
|
+Install from NPM:
|
|
|
+
|
|
|
```shell
|
|
|
npm install @uppy/form
|
|
|
```
|
|
|
|
|
|
## Options
|
|
|
|
|
|
+The Form plugin has the following configurable options:
|
|
|
+
|
|
|
```js
|
|
|
uppy.use(Form, {
|
|
|
target: null,
|
|
@@ -37,19 +41,19 @@ uppy.use(Form, {
|
|
|
|
|
|
### `id: 'Form'`
|
|
|
|
|
|
-A unique identifier for this Form. Defaults to `'Form'`.
|
|
|
+A unique identifier for this Form. It defaults to `'Form'`.
|
|
|
|
|
|
### `target: null`
|
|
|
|
|
|
-DOM element or CSS selector for the form element. Required for the plugin to work.
|
|
|
+DOM element or CSS selector for the form element. This is required for the plugin to work.
|
|
|
|
|
|
### `getMetaFromForm: true`
|
|
|
|
|
|
-Whether to extract metadata from the form. When set to true, `Form` plugin will extract all fields from a `<form>` element before upload begins. Those fields will then be added to global `uppy.state.meta` and each file’s meta, and appended as (meta)data to the upload in an object with `[file input name attribute]` -> `[file input value]` key/values.
|
|
|
+Configures whether or not to extract metadata from the form. When set to true, the `Form` plugin will extract all fields from a `<form>` element before upload begins. Those fields will then be added to global `uppy.state.meta` and each file’s meta, and appended as (meta)data to the upload in an object with `[file input name attribute]` -> `[file input value]` key/values.
|
|
|
|
|
|
### `addResultToForm: true`
|
|
|
|
|
|
-Whether to add upload/encoding results back to the form in an `<input name="uppyResult" type="hidden">` element.
|
|
|
+Configures whether or not to add upload/encoding results back to the form in an `<input name="uppyResult" type="hidden">` element.
|
|
|
|
|
|
### `resultName: 'uppyResult'`
|
|
|
|
|
@@ -57,4 +61,4 @@ The `name` attribute for the `<input type="hidden">` where the result will be ad
|
|
|
|
|
|
### `submitOnSuccess: false`
|
|
|
|
|
|
-Whether to submit the form after Uppy finishes uploading/encoding.
|
|
|
+Configures whether or not to submit the form after Uppy finishes uploading/encoding.
|