https://github.com/markmead/alpinejs-form-data
Get the data from the form in a key/value pair of name and value 🥯
https://github.com/markmead/alpinejs-form-data
alpine-js alpinejs alpinejs-form alpinejs-plugin javascript-form
Last synced: 10 months ago
JSON representation
Get the data from the form in a key/value pair of name and value 🥯
- Host: GitHub
- URL: https://github.com/markmead/alpinejs-form-data
- Owner: markmead
- License: mit
- Created: 2022-11-08T14:55:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-07T08:15:25.000Z (11 months ago)
- Last Synced: 2025-03-24T20:12:31.349Z (10 months ago)
- Topics: alpine-js, alpinejs, alpinejs-form, alpinejs-plugin, javascript-form
- Language: JavaScript
- Homepage: https://js.hyperui.dev/examples/form-retrieve-data
- Size: 23.4 KB
- Stars: 22
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Alpine JS Form Data
Get the data from the form in a key/value pair of name and value 🥯
## Install
### With a CDN
```html
```
### With a Package Manager
```shell
yarn add -D alpinejs-form-data
npm install -D alpinejs-form-data
```
```js
import Alpine from 'alpinejs'
import formData from 'alpinejs-form-data'
Alpine.plugin(formData)
Alpine.start()
```
## Example
```html
Submit
```
On submit this will return the following:
```
{title: 'My New Blog Post', slug: 'my-new-blog-post'}
```
### Returning Data as Array
You may want the data returned to be a nested array:
```
[
['title', 'My New Blog Post'],
['slug', 'my-new-blog-post'],
]
```
To do this you can use `$formDataArray` instead of `$formData`.
## Stats



