# form-async

> The simplest, fastest way to send ajax request when form changes.

Latest version **2.0.2** (published 2020-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install form-async
pnpm add form-async
yarn add form-async
bun add form-async
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2020-10-18 |
| First published | 2019-04-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 19.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Form Async and other contributors |
| Maintainers | lognoz |
| Keywords | jquery-plugin, autosave, input, form, interval, client, jquery, browser, js-autosave |

## Links

- npm: https://www.npmjs.com/package/form-async
- Repository: https://github.com/lognoz/form-async
- Homepage: https://github.com/lognoz/form-async#readme
- Issues: https://github.com/lognoz/form-async/issues
- npm.io page: https://npm.io/package/form-async

## Dependencies (1)

- [jquery](https://npm.io/package/jquery.md) >=3.4.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2020-10-18
- 2.0.1 — 2019-04-27
- 2.0.0 — 2019-04-13

## README

# Form Async

<a href="https://www.npmjs.com/package/form-async"><img src="https://img.shields.io/npm/v/form-async.svg?style=flat-square"></a>
<a href="https://travis-ci.org/lognoz/form-async"><img src="https://img.shields.io/travis/lognoz/form-async/master.svg?style=flat-square" alt="Build Status"></a>

Form Async is an easy-to-use library that provide acronymous sending on form changes. It's a great solution to preventing data loss when filling out a web form.

## Features

- Lightweight (~1.5kb gziped)
- Saves any HTML form element
- Support content editable property
- Full customization
- Retry functionality if ajax request fail
- Send form elements as group of field
- Provide the way to validate changes before sending ajax request
- Heavily tested

## Installation

``` bash
$ npm install form-async
```

We recommend installing from npm and then using a module bundler such as [RequireJS](https://requirejs.org), [Webpack](https://webpack.js.org) or [Browserify](http://browserify.org).

Alternatively, you can use [jsdelivr CDN](https://www.jsdelivr.com/package/npm/form-async) instead of npm.

```html
<!-- 1. Add JS before the closing `</body>` -->
<script src="jquery.js"></script>
<script src="form-async.js"></script>

<!-- 2. Initialize -->
<form action="/ajax/account">
   <input name="xs_username">
</form>

<script>
   $("form").async();
</script>
```
## Documentation
**[Read the docs](https://code.lognoz.org/form-async/)** for more details on how to use Form Async.

### Callbacks
- [`before`](https://code.lognoz.org/form-async/callbacks/before/) — pre-request function that can be use to validate data before it is sent
- [`success`](https://code.lognoz.org/form-async/callbacks/success/) — function invoked if the request succeeds
- [`error`](https://code.lognoz.org/form-async/callbacks/error/) — function invoked if the request fails

## Software
We use Browserstack for manual testing
<a href="https://www.browserstack.com" target="_blank">
  <img align="left" width="117" alt="BrowserStack logo" src="https://i.ibb.co/HDRDHmx/Browserstack-logo-2x.png">
</a>

---
_Source: https://npm.io/package/form-async · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
